Skip to main content

Notifications

Announcements

No record found.

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 ?

  • Suggested answer
    XM-22040801-0 Profile Picture
    XM-22040801-0 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

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 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.

  • Verified answer
    Guido Preite Profile Picture
    Guido Preite 54,069 Super User 2024 Season 1 on at
    RE: javascript function in onload for all the forms

    yes

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans