Reputation: 409
I have added a button to my ribbon and I want to define a DisplayRule/ValueRule that checks if a lookup field has a certain value. I don't want to use the GUID but the actual name of the value because GUIDS might differ on Development, Test and Production.
<DisplayRule Id="MyCompany.Form.account.MainTab.Actions.ShowWebSite.Command.DisplayRule.ValueRule">
<ValueRule Default="true" InvertResult="false" Field="new_countryid" Value="France" />
</DisplayRule>
Does anyone know how to do this?
Upvotes: 0
Views: 2600
Reputation: 18895
My bad, you can't setup a javascript rule on the display. You might be forced to set it up on the enable...
You can create a custom javascript rule that runs javascript that looks up the name of the lookup field. Something like this:
var name = Xrm.Page.getAttribute("new_myLookupAttribute").getSelectedOption().text;
return name == "Foo";
Upvotes: 1
Reputation: 1951
You're using the attribute which will contain the GUID. So try putting the GUID of France or using "new_countryid_name" for the field.
Upvotes: 0