Enable/Disable Ribbon button From Entity Form

Today I need to Enable/Disable Ribbon on Entity Form and after some research i found two mathod that are very helpfule to me to resolve my issue
1) using CustomRule
using this rule we can call our javascript function and check required condition. According to condition return true (to enable ribbon button) or false (to disable ribbon button)
With CustomRule we also able to send differen type of paramerters like :

 Name = "String"
 Value= ["CommandProperties" |
         "PrimaryEntityTypeCode" |
         "PrimaryEntityTypeName" |
         "PrimaryItemIds" |
         "FirstPrimaryItemId" |
         "PrimaryControl" |
         "PrimaryControlId" |
         "SelectedEntityTypeCode" |
         "SelectedEntityTypeName" |
         "FirstSelectedItemId" |
         "SelectedControl" |
         "SelectedControlSelectedItemCount" |
         "SelectedControlSelectedItemIds" |
         "SelectedControlSelectedItemReferences" |
         "SelectedControlAllItemCount" |
         "SelectedControlAllItemIds" |
         "SelectedControlAllItemReferences" |
         "SelectedControlUnselectedItemCount" |
         "SelectedControlUnselectedItemIds" |
         "SelectedControlUnselectedItemReferences" |
         "OrgName" |
         "OrgLcid" |

<EnableRule Id="Mscrm.Isv.account.Form.CustomButton.Enable">              
<CustomRule FunctionName="isenable" Library="$webresource:new_account.js">
                <CrmParameter Value="SelectedControlSelectedItemCount" />

Javascript function
function isenable(_itemcount) {
    if (itemcount== 1) {   
//write you logic     
return true;
    else {
        return false;

2) using ValueRule

<EnableRule Id="Mscrm.Isv.account.Form.CustomButton.Enable">              
<ValueRule Field="new_customerrel" Value="3" Default="0" />         
This entry was posted in MS Dynamic CRM 2011. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>