Validate by calculation truthiness

Discussion created by belg4mit on Sep 19, 2018
Latest reply on Sep 21, 2018 by belg4mit

I am trying to do some validation by calculation and getting very odd and inconsistent results on FM16 and FM17. Here are a set of validation calculations I have tried in debugging, all work except the last one, which is the one that is actually needed:


Let([$$a=1; $$b=1; $$c=(a=b)]; $$c) //Succeeds

Let([$$a="Yes"; $$b="Yes"; $$c=$$a=$$b]; $$c) //Succeeds

Let([$$a=Self; $$b="Yes"; $$c=$$a=$$b]; $$c) //Succeeds if the field is Yes

Let([$$a=Self; $$b=Yes(); $$c=$$a=$$b]; $$c) //Succeeds if the field is Yes, where Yes() is a custom function that simply returns Yes i.e; $$a="Yes; $$b="Yes" and $$c=1

Let([$$a=Self; $$b=Complex(); $$c=$$a=$$b]; $$c) //FAILS when the field is Yes, and the Complex custom function returns Yes i.e; $$a="Yes; $$b="Yes" and $$c=1


For the curious: the field being validated is a global used to collect input for a script to scribble elsewhere. Complex() is pulling the previously scribbled value of the field out of a cache table, and the goal is to warn the user about changing a previously committed value.


P.S. I'm using OnValidate script triggers for other other fields, but I want these to be tied to the field and not the layout, so that the validation occurs however someone might use the field, therefore switching to triggers does not really solve my problem.