Hi team,
does anyone has tried to provide the velocity template as the varaiable in the define variable operator in workflows. Is there any possibility for it.
when I tried I am getting not a valid json
the expression I used is as follows #if({{$.trigger.stafftype}}==‘N’)fd4708bf2dcd49ddb5e0c241a9c30438 #elseif (!{{$.trigger.stafftype}}==‘N’ && !{{$.trigger.studenttype}}==‘N’)fd4708bf2dcd49ddb5e0c241a9c564438#{else}e5d708bf2dcd49ddb5e0c241a9c30438#end
I need this varaiable to store the sourceid where depending on the trigger input I want to create account in the three different sources.
but I want to minimize it by writing only one create account step where the source id will be from the define varaiable step.
Velocity Templating is not supported in ISC Workflow. Instead what you can do is use “Compare String” action to compare if sourceId is equal too source1 then do the action you want and if false, add another “Compare String”. This would create a if-else ladder and you can define your workflow action in there.
As you mentioned you need only one “Create Account” operation then in each ladder use define Variable to store the sourceId, name each variable as “x” in the Define Variable action and frame the JSONPath expression as “$[‘defineVariable’,‘defineVariable1’,‘defineVariable2’].x”. This way it outputs only the non-null value.
In defineVariable, you would define the sourceIds and when you would use $[‘defineVariable’,‘defineVariable1’,‘defineVariable2’].x, this will directly get you the intended sourceId to use in sourceId field.
I was able to reproduce the issue. I added another Define Variable action and referenced that variable in my http request and that produced the intended json response.