I’m using an exclusive gateway in my workflow. This GW should decide if a service needs to be called or if the call can be skipped. (Either an ‘service result id’ was provided to the workflow or none was provided).
Currently I modeled this check with an expression on the outgoing sequence flows this way:
alternative 1: ${service_result_id != ‘0’}
alternative 2: Default Flow
But for this to work I have to set the 'service_result_id ’ artificially to 0 if the result wasn’t provided to the workflow.
What I real want to do, is to check if the variable 'service_result_id ’ is defined or not. Is there a way to achieve this?
I’ve actually just fought the exception during startup of a process (in my case it was because of a DMN defining the variable but the Business Rule task did not specified the result).
How do you invoke this workflow?
If the input comes from an intermediate task I’d “initialize” the variable to null before (possibly) invoking the intermediate task.
If this isn’t the case I’d use what you likely have done already - call a service task that only checks if the variable is set and if not set to to null (I still would use this instead of 0).
I know i can use ‘null’ or maybe ‘empty’ (not sure about the second) - but I want to know if there is another way. Maybe using input/output variables etc.
As example: I saw someone using an output like: Name:result_id_global, Type:Text, Value:{#result_id}
But I do not understand yet what this is doing.
Wow! If I’ve actually provided something you didn’t know Stephen, I’m thrilled. I feel so ignorant compared to so many in this forum, so I appreciate the comment.
Have you tried ${myvar??} ? The double question mark usually checks in freemarker if a variable exists. I don’t know if it works on a gateway as well but you could give it a try.