-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebResource in Dynamics 365 #7
Comments
Hi @MSCRMGuru , Secondly, you need to choose if you wish to use Promise or Callbacks based library: dynamics-web-api.js is a Promise based library and dynamics-web-api-callbacks.js is a Callbacks based library. If you choose Promise based library I would recommend adding ES6-Promise or Yaku polyfill libraries to the form. if you choose Callbacks - then no other libraries needed. You do not need either require.js or head.js for the library to work. Let me know if this resolves your issue. P.S. you can also use minified versions in CRM. |
Hi @MSCRMGuru , What is the error on top of the line |
So, it does not work when you add that line to OnLoad event or to OnChange event? I cannot get it why it's not working on your side. Feels like the web resource is just not loading... |
can you try to empty dynamicsWebApi web resource and put there these simple lines? var DynamicsWebApi = function(){
this.test = function(){
alert("it's working");
}
} And just to try to create an object, will that work? If not, then something wrong with web resource loading. |
HI @MSCRMGuru , How do you upload web resources? Are you using Visual Studio or CRM UI? Other than that, I suggest using Visual Studio to upload and publish web resources (unless you already do that, if so... I've no idea what's wrong, except the DynamicsWebApi code you upload is corrupted). |
Hey, i'm using the XrmToolbox WebResource Manager to upload the script, which i'm copying directly from the GitHub "View Raw" page for the callbacks javascript... I'll give it a try today with other CRM organisations\versions and see what I come up with. I'll provide an update later on. Thanks again for your help! |
I don't know why or how, but it suddenly started working for me. I thought id give it one more test before trying a different framework, and it started working... Same org, same browser, same everything. Only thing that was done this mornign was an update of sitemap and republish of all customistions. This was also done yesterday when this wasn't working.... Not sure if its Dynamics 365 being slow, or something was cached, but it seems to b e working fine now. A bit concerning as if it breaks I won't really know how to fix it, but I guess i'll let future me worry about that :) Thanks again for all your help! |
I'm glad it's working! |
I found the issue!! It started happening again a few minutes after I started including my code and it nearly drove me nuts... I was using Edge to test (since I had other Office 365 session in all my other browsers), and it actually provided a helpful message: Mismatched Anonymous Define().... I had a look and found this stackoverflow question about this. Dynamics 365 with the latest Project Service Automation (PSA) will have some custom scripts loaded on various forms, and it uses require.js as well as head.js: Removing both require and head from the Account form resolved the issue. It worked previously becuase the DynamicsWebApi library was loaded before require.js - if it was loaded after it wouldn't work... Not sure if you can fix this or how, but if require.js is included in the same form as your library things will randomly break.... For the moment I removed it and disabled the onload handlers that require it, but it's not a great solution.... Any thoughts?? |
Interesting, I will check that behaviour. Why not load DynamicsWebApi first for now? Thanks |
Hi @MSCRMGuru , Thank you to your investigation and help! |
Hey Alex, Thanks for your incredible responsiveness in helping look into the issue and resolving it. I haven't tested this yet and hope to get it tested in the next few days. I will let you know if I come across any other issues! Thanks! |
Hi,
I'm trying to use the file as a WebResource in Dynamics 365. I keep getting an error saying DynamicsWebApi is not defined when trying to create one (var x = new DynamicsWebApi();). It's been added to the form as a library.
Tried to use require.js and head,js to load it but got the same result...
I wasn't sure which file in the dist folder is the correct one so I tried with all of them with the same result.
This is with Dynamics 365 trial.
Thanks!
The text was updated successfully, but these errors were encountered: