Hiding a button when form is in create type using Ribbon Work bench

Recently, We have a requirement to hide a button while creating a new record in ms crm.

We can achieve the requirement, in two ways under ribbon-workbench as follows:

1- Form State rule  and 2. Custom  Role

First add the button to the form and create the new  command . Every command must have Action and Enable rules and Display Rules.

Action – On-click of button, it must have some functionality.

Enable and Display rules are used to show and hide a button.

Form State Rule– 

without coding – Go to  Display rule – Form State rulescreenshot-335.png

Add the above display rule to command and attach the command to button.

Custom Code Rule –

Go to- Enable rules- Custom Rule

It will ask the function name and web resource name. Before that add the web resource in Ur solution, so that when u click on search button it will display and select that web resource. give Exact function name .


web resource – JavaScript code as follows:-

//formtype is "1" then it is new form and if formtype is "2" then it is update form
function hide(){
 var formtype = Xrm.Page.ui.getFormType();
 return false;
 return true;

Add the above Enable rule to command and attach the command to button.

Thats it.

Crming- Enjoy 🙂




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s