<CustomActions> <CustomAction Id="CA_CUSTOM_CompanyFunction" Location="Mscrm.Form.account.MainTab.Save.Controls._children" Sequence="35"> <CommandUIDefinition> <Button Id="B_CUSTOM_CompanyFunction" Command="Cmd_CUSTOM_CompanyFunction" LabelText="Company Matters" ToolTipTitle="Company related Matters" ToolTipDescription="This calculate and gives you the company related information" TemplateAlias="o1" Image16by16="/_imgs/SFA/calculate_16.png" Image32by32="/_imgs/ribbon/calculate32.png"/> </CommandUIDefinition> </CustomAction> </CustomActions> <CommandDefinitions> <CommandDefinition Id="Cmd_CUSTOM_CompanyFunction"> <EnableRules> <EnableRule Id="ER_CUSTOM_CompanyCustomer" /> </EnableRules> <DisplayRules> <DisplayRule Id="Mscrm.CanSaveAndClosePrimaryEntityType" /> </DisplayRules> <Actions /> </CommandDefinition> </CommandDefinitions>
Now, take a close look at the enable rule ER_CUSTOM_CompanyCustomer which is defined by me. This is to be defined with our criteria. Interesting part of ribbon is that I can define those in a special section called <RuleDefinitions>. Under this tag, we can see two sections to define two kinds of rules. Namely Display rules and Enable rules. See carefully, how I have defined my enable rule there.
<RuleDefinitions> <TabDisplayRules /> <DisplayRules> ---------- </DisplayRules> <EnableRules> <EnableRule Id="ER_CUSTOM_CompanyCustomer"> <ValueRule Default="false" Field="new_typeofcustomer" InvertResult="false" Value="100000001"/> </EnableRule> </EnableRules> </RuleDefinitions>
Here mew_typeofcustomer is the name of optionlist and 100000001 Is the value of company.
We didn’t have this kind of controlling power in CRM 4.0. This is cool.
(Read about Displayrules here.)
No comments:
Post a Comment