Ribbon

How to Show/Hide Custom Ribbon Button on Dynamics 365 v9.x

Hide/Show OOB Dynamics 365 Ribbon Button with Enable Rule Based One Users Security Role


Show/Hide Ribbon Button Using Crm Parameter PrimaryControl Dynamics 365 v9.x 

Click on the link to learn step by step ribbon customization with CRM Modal Dialog Form

Hide/Show OOB Activate and Deactivate Ribbon Button Based on Security Role D365

This is the most desirable requirement which we get day today in every development phase. This is a very common requirement that occurs frequently while developing Dynamics 365 products for the client. 

There is always a small mistake that we do while applying this functionality and it kills a lot of development time. So, to avoid that this blog is gonna help. You can easily achieve your requirement without any heat.

Follow the below procedure:

1. Add the below code to your webresource script library file:

HideShowRibbonButton: function (primaryControl) {
            var formContext = primaryControl; 
            if (formContext.getAttribute("new_attributename").getValue() == null) {
                return false;
            }
            else {
                return true;
            }
        }

2. Go to solution > Click on Ribbon Workbench > Select the desired Solution in which you have added entity to add button on > Drag and Add Button on the Form> Enter Properties Control Values as shown in below image > Choose Command from the drop-down (Refer Step:4)


3. Add Enable Rules and fill Properties Enable Rule values as shown in the below image


4. Add Command and in the command add Enable Rule which you created as shown below:



5. Publish your Changes and verify them in CRM:


All Done. Thanks!

No comments:

Post a Comment