web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to use window.onload and window.on unload on ribbon button enable rule custom rule step

(0) ShareShare
ReportReport
Posted on by 860

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)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans