Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Sub-Grid plus (+) button onClick event

Posted on by Microsoft Employee

I have to fire a custom java script code for checking some required fields are blank or not in an entity on Sub-Grid plus (+) onClick event. If the required fields are blank then Sub-Grid (+) button will not open the form of related entity and also fire an alert message that those fields have to filled up.

So, could You please tell me that "How could I find the id of Sub-Grid plus (+) button and onClick event to fire the custom java script code" for validating the required field of a parent entity?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sub-Grid plus (+) button onClick event

    Hi,
    I have done some RND for this requirement. I have got the solution and the approach is, We don't need to hide the plus (+) button of a SubGrid. You can go to the "Customized Command" of the selected button on which You are trying to fire any OnClick event such as alert. In that case You have to create 1 new "Enable Rule" where You will choose the "Customized Java Script function Rule" from the Web resource where You can simply write an alert() for testing and You have to associate that new "Enable Rule" with that "Customized Command" of that Button. I think  alert() will work after clicking on the SubGrid plus button and also before opening the SubGrid Form.

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Sub-Grid plus (+) button onClick event

    Another option is you can inject your custom code before CRM + button event.

    You can customize + button command, and call your own javascript and in that javascript after validation you can call CRM function.

    Here is one example.. which is done on CRM button.. but you can do it same on sub grid + button.

    mahadeomatre.blogspot.com/.../inject-your-code-before-crm-button.html

    hope this will help..

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Sub-Grid plus (+) button onClick event

    Hi Arunabha,

    You need to disable OOTB + button , create new button and fire JS function in the command action.

    Please refer old thread -

    community.dynamics.com/.../273770

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans