i have setup a couple of custom decisions.
it seems if you return anything that is enough to trigger a "true" evaluation of the decision.
is there something that should be done on a negative result other than not returning anything?
i.e. should an exception be thrown?
if (currentSysprep == "true")
{
return currentSysprep;
}
else
{
// should something be done here?
}
Yes, you should:
return false;
All decision boxes should return a true and a false ...
Yes, you should:
return false;
All decision boxes should return a true and a false ...
Hi!
For the reference: This is expected behaviour in Javascript. Everything which is not explicitly
means true.
See here:
http://www.w3schools.com/JS/js_obj_boolean.asp
Cheers,
Joerg
BTW: Custom Decisions can also throw exceptions, but this should only be used if there is really an unexpected error inside the script.
You cannot "handle/catch" the execption outside, because there is no Exception Binding for Custom Decisions available, so your complete workflow will fail if you throw an Exception insinde a decision.
It's an absolute "Anti-pattern" to use exceptions to implement some business-logic, so you should follow Burke's tip and always return a clear "true" or "false". (makes it also easier to maintain, if you read the code in several month again 🙂 )
Regards,
Joerg