PaulNieuwelaar / alertjs

Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
https://www.magnetismsolutions.com/our-products/alertjs-alert-popup-for-d365
Other
96 stars 38 forks source link

Alert.showWebResource fail in CRM build 1710 #24

Closed LangateDev closed 6 years ago

LangateDev commented 6 years ago

The Alert._jQuery from Alert.js ver. 2.1 doesn't get a reference to jQuery, it remains "undefined" resulting in a non working alert, iframe or dialog feature in CRM 365 Version 1710 (9.0.2.2078) online.

LangateDev commented 6 years ago

A possible fix is to reassure that the refetence is set by adding a check at the beginning of Alert.show or eq. Alert._jQuery = !Alert._jQuery ? window.jQuery ? window.$ : parent.$ : Alert._jQuery;

Our callbacks doesn't work for Alert.js ver. 2.2. But the error/fix reported above regards both 2.1 and 2.2.

PaulNieuwelaar commented 6 years ago

Hi, do you have another version of jQuery being loaded onto the form? I have seen similar issues when another solution overwrites CRMs jQuery reference which messes it up.

LangateDev commented 6 years ago

The webresource using Alert.js also implements jQuery script from the following source: https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.min.js

I got it working with some changes. I added a check for jQuery in the beginning of the show function: Alert._jQuery = !Alert._jQuery ? window.jQuery ? window.$ : parent.$ : Alert._jQuery;

It worked fine until we got CRM updated to ver. 9.0. As I mentioned, I didn’t get the ver. 2.2 of Alert.js to work. Submitted buttons didn’t trigger the callbacks.

PaulNieuwelaar commented 6 years ago

Hi, v2.2 is not a stable release so stick with v2.1. I'll see if I can reproduce the issue you're having by installing some other solutions with jQuery, and I'll probably update v3.0 with a similar fix to what you've done. Thanks for the detailed explanation. Cheers, Paul

PaulNieuwelaar commented 6 years ago

Hi again, I just noticed you said you were calling Alert.js from a web resource? If this is the case, you need to add a manual reference to jQuery before Alert.js is loaded.

It looks like you're already adding jQuery (but the version is very old), so make sure the Githubissues.

  • Githubissues is a development platform for aggregating issues.