Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Call an JavaScript action to enable or disable a button

(0) ShareShare
ReportReport
Posted on by 1,329

Hi,

 

    I am using "selectedItems" from the records selected in the Grid to enable a button in the sub grid,

if I included javascript to get the selectedItems in enable rules, on sub grid onload the javascript is firing and getting null reference to the "selectedItems" array returned.

 

Can we disable/enable the sub grid buttons through actions itself....becoz I need to get the selectedItems once I click on any subgrid record and not on grid load.

any alternate solution ?

         

*This post is locked for comments

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Call an JavaScript action to enable or disable a button

    if you have enable rule, and based on your condition yes it will disable your button.

  • pavanmanideep Profile Picture
    pavanmanideep 1,329 on at
    RE: Call an JavaScript action to enable or disable a button

    Hi,

         What if after comparison, if it returns false, does the button get's  disabled if we

    return false to the action ..I can't use PrimaryEntityTypeName for validation.. awaiting for your reply...

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Call an JavaScript action to enable or disable a button

    Yes, you can do that as well, you can utilize PrimaryEntityTypeName parameter, please check : msdn.microsoft.com/.../gg309332.aspx

  • pavanmanideep Profile Picture
    pavanmanideep 1,329 on at
    RE: Call an JavaScript action to enable or disable a button

    Thanks for your reply,

    Ok I am able to call custom js in actions to get the selectedItems once I click on a record in the grid, but after that I need to perform validation which type of activity it is,

    can I do that within the same js within the action?

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Call an JavaScript action to enable or disable a button

    Yes, you can do that, you can have your js code, to check if there is any record selected only then run your custom logic.

    Check this: nishantrana.me/.../enabling-button-in-subgrid-on-selection-of-record-selectioncountrule-in-crm-2011

    ribbonworkbench.uservoice.com/.../129783-pass-the-currently-selected-grid-row-s-to-a-custo

    Thanks

  • Verified answer
    P. R. M Profile Picture
    P. R. M 739 on at
    RE: Call an JavaScript action to enable or disable a button

    Please try below community blog that disable/enables the sub-grid button with custom actions only:

    community.dynamics.com/.../enable-disable-out-of-box-buttons-sub-grid-based-on-a-custom-rule-in-crm-2011

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans