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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Hide subgrid buttons on a specific entity.

(0) ShareShare
ReportReport
Posted on by 277

Hi Experts, I want to hide a subgrid button depending upon current form field value and for specific entity. 

I tried some OOB rules and it's is working but the thing is: This subgrid is on different entities where the button needs to be visible, and the fields I'm trying to use have same schema name.

Is there a specific OOB rule to check for entity type? Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi ,

    You can use following logic inside js:

    var variablename = Xrm.Page.getAttribute("fieldlogicalname");

    var entityname = Xrm.Page.data.entity.getEntityName();

    if (variablename != null && entityname== "expectedlogicalname")

    {

    var variablevalue = variablename.getValue();

    if (variablevalue != null)

    return false

    else

    return true;

    }

    Call this function code on button using ribbon action.

  • Turbo Forms Profile Picture
    277 on at

    Hi Pravin, Thanks for the reply. I tried the below code but it's still not working. ANy idea? 

    function HideButtonsAfterRouted(primaryControl) {
        formContext = primaryControl;
        debugger;
        var routed = formContext.getAttribute("new_routed").getValue;
        var initApproved = formContext.getAttribute("new_initiatorapproved").getValue;
        var recordType = formContext.getAttribute("new_recordtype").getValue;
    
        var entityname = formContext.data.entity.getEntityName();
    
        if (entityname == "new_request" && (recordType == 800000010 || recordType == 800000011)) {
    
            if (routed == 1)
                return false
            else
                return true;
        }
        else if (entityname == "new_request" && (recordType == 800000029 || recordType == 800000030 || recordType == 800000031 || recordType == 800000032)) {
    
            if (initApproved == 1)
                return false
            else
                return true;
        }
    }


    4251.Capture.PNG

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans