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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

javascript function in onload for all the forms

(0) ShareShare
ReportReport
Posted on by

I need to execute a JavaScript function in onload event of all the forms (nearly 15 forms I'm having). Do we need to add this function in each of the form ?

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,084 Moderator on at
    RE: javascript function in onload for all the forms

    yes

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: javascript function in onload for all the forms

    Hello,

    There is a way to do it in one go but it's a bit hacky - you can add the button to the entity's for ribbon and add the enable rule to it that has to always return false to hide it. You can put the logic you want to use inside and that's it.

  • Suggested answer
    XM-22040801-0 Profile Picture
    11 on at
    RE: javascript function in onload for all the forms

    Yes, you must do it.

    To do it quickly, you can use Form Libraries Manager of XrmToolBox.

    - Load your solution (it must contain your forms)
    - Select the JS file
    - Select the forms in the right panel
    - Click on Add checked script
    - Select all forms to add the onload event (you can use the mouse or CTRL / SHIFT to select more than one)
    - Right click => Manage OnLoad events
    - Add your script and function

    pastedimage1679574408905v1.png

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 120 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 119

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans