CRM 2011 Ribbon DisplayRule ValueRule check for null
dynamics-crm, dynamics-crm-2011
Solution
Good question, but unfortunately I don't think there's any good answer here because I think it's a bug. If you use `"null"` as the value for a string attribute in a `ValueRule` for an `EnableRule`, you'll see that the button in fact becomes enabled (or disabled depending on what you set for `InvertResult`). It just doesn't work for `DisplayRule`s. (My best guess is they just put more effort into developing `EnableRules` instead of `DisplayRules`; as mentioned in your link, there's no support for `CustomRule`s for `DisplayRules` either, though it exists for `EnableRules`.)
I'd file a bug report, but Microsoft Connect is still only accepting "suggestions" for Dynamics CRM.
Problem
Quick one, I don't see any direct answers out there so I thought I'd ask. (Here is the same question asked on the microsoft social site and it is unanswered as well) If I have a DisplayRule and a ValueRule in that, how can I check for null? This suggested solution below apparently doesn't work (according to the linked question): ``` <DisplayRule Id="new.incident.form.IsNotRelatedToY.DisplayRule"> <ValueRule Field="YId" Value="null" InvertResult="true" /> </DisplayRule> ``` Does it depend on the type of Field? If so I need it to work in two seperate cases, when YId is an entity reference, and also when YId is a string. I figure "null" cannot work for a string, because "null" is a valid string. Anyone have a working example? EDIT: it looks like the ValueRule documentation has nothing on the subject.