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 :
Microsoft Dynamics CRM (Archived)

Call an JavaScript action to enable or disable a button

(0) ShareShare
ReportReport
Posted on by 1,331

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

I have the same question (0)
  • Verified answer
    P. R. M Profile Picture
    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

  • Suggested answer
    Mahendar Pal Profile Picture
    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

  • pavanmanideep Profile Picture
    1,331 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?

  • Verified answer
    Mahendar Pal Profile Picture
    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
    1,331 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...

  • Mahendar Pal Profile Picture
    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.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans