
Hi guys,
i have a validation in setup once i mentioned in status ::Error and Check box set "Yes".
in main form while saving i want to reason code "Must be filled in reason code".
issue:
but i am not mentioned above two status while saving gave error "Must be filled in reason code". what can be issue ?
public boolean checkMandatoryReasonCode()
{
boolean ret = true;
SDSExcuseSetup setup = SDSExcuseSetup::find(this.ExcuseId);
if (setup.MandatoryNotificationType == SDSNotificationType::Error
||setup.ReasonCode == NoYes::Yes && !this.ReasonCode)
{
ret = checkFailed(strFmt("@SDS4015"));
}
return ret;
}
i mapped in above code in validateWrite
like : ret = ret && this.checkMandatoryReasonCode();
what did am i missing ?
Thanks
Debug the code to see what's going on.
Maybe checkMandatoryReasonCode() isn't called at all, because ret in validateWrite() is already false.
Maybe those three conditions aren't interpreted in the order you expect. I strongly recommend that you should use parentheses rather than depending on the operator precedence. It'll prevent this kind of bugs and make your code easier to read and maintain.