2

I want to add a display rule to a custom ribbon button based on the value of a lookup field whether the lookup field is null or not. How should i check it. The below code is not working. I assigned value as 0 , "" but still it was not working. Please give some solution. Thanks.

<DisplayRule Id="mcg.mcg_transition.DisplayRule_lookup.DisplayRule">
    <ValueRule Field="ifx_lookupid" Value="null" Default="true" InvertResult="false" />
</DisplayRule>
Neodine
  • 53
  • 1
  • 7

1 Answers1

2

Use Enable Rule as it gives the facility to write some JavaScript function.

//Check if the field value is null or not? '
//in my case the field I am checking for null value is ifx_lookupid.

function DisplayRule_IfField_IsNull()
{
    var regardingField = Xrm.Page.getAttribute("ifx_lookupid");
    if (regardingField != undefined && regardingField != null) {
        return true;
        }
        else {
            return false;
        }
    }
}

Hope this will help.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
mzh
  • 515
  • 8
  • 21