D365 CE UCI JavaScript: alert() throwing error, replace with Xrm.Navigation.openAlertDialog

Sabjan SamaDyn365CE5 years ago18 Views

Geeks,
JavaScript on new interface UCI is throwing error when we use standard alert() method on BPF field OnChange event.
alert(“message”); //Old code that is failing
sometimes it takes you to infinite loop after you click Ok to come out of context.
Easy fix as suggested by Microsoft to start use below code on UCI and .then() for call back functions is optional
Xrm.Navigation.openAlertDialog({ confirmButtonLabel: "Ok", text: "message" }).then(
    function success(result) {
        console.log("Alert dialog closed");
    },
    function (error) {
        console.log(error.message);
    }
);// new code working
Version: D365 CE online v 9.1 wave 2
Further read Click here

Original Post https://mscrmsama.wordpress.com/2019/11/01/d365-ce-uci-javascript-alert-throwing-error-replace-with-xrm-navigation-openalertdialog/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...