VMware Cloud Community
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

Custom Decisions

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?

}

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

Yes, you should:

return false;

All decision boxes should return a true and a false Smiley Happy ...

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
3 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

Yes, you should:

return false;

All decision boxes should return a true and a false Smiley Happy ...

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Hi!

For the reference: This is expected behaviour in Javascript. Everything which is not explicitly

  • 0
  • -0
  • null
  • ""
  • false
  • undefined
  • NaN

means true.

See here:

http://www.w3schools.com/JS/js_obj_boolean.asp

Cheers,

Joerg

tschoergez
Leadership
Leadership
Jump to solution

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