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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Sub-Grid plus (+) button onClick event

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    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..

  • Verified answer
    Community Member Profile Picture
    on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
NeerajPawar Profile Picture

NeerajPawar 2

#2
jlattimer Profile Picture

jlattimer 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans