Load external library in javascript Dynamics 365

Instead of putting the entire code of an external API in a javascript web resource and later referring it to call one of it’s method to perform some action, we can also hit the API URL directly and refer it’s methods. It can save us from adding one extra web resource for API code only. Below is the code to achieve this:

LoadApi: function () {
$ = parent.$;

// replace url with the API URL
var url = "https://maps.googleapis.com/maps/api/js?key={apikey}&libraries=places";
$.Deferred(function (deferred) {
).done(function () {

// Call method from API code and perform your actions
//Here we have called load method as below:
parent.google.load("maps", "3", { other_params: "libraries=places&sensor=false", "callback": "yourmethod"});


Hope it helps.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.