
Hi Experts,
I want to run JavaScripts on crm window open and close through window.onload and window.onunload through enable rule of custom button on application ribbon.
Is it possible with dynamics 365 online.
If yes please suggest the suitable way
Thanks in advance
*This post is locked for comments
I have the same question (0)Hi,
You can create an onLoad event and onSave event for your form when the form loads/saves by adding a library and function to the Form Properties. There is no CRM onUnload event for your form, but you can add a custom form script on your javascript library such as:
window.onbeforeunload = function() {
// Add Code to Process the Unload event
}
In your solution, expand the entity and click on Forms. Open the form that you want to use, and within the form click on Form Properties. Add the form library and the Form event handlers that you are looking for.
Regarding the custom buttons that you want to add to your ribbons, what is important to state is that command bar enable rules execute prior to the onload event of the form in CRM, so you need to make sure that whatever code you need to execute is handled by the custom action of the enable rules.