Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Workflow scratchpad variable undefined check

kailashthiyagar
Kilo Guru

i have two flows in my workflow. In one f the flows, i m setting the scratchPad variable initially to false and changing it to true later on task completion. If it follows the other parth, the variable declaration itself will not take place..

I m trying something like the below one but it is not working. can someone help me on this?

if(workflow.scratchpad.taskCompleted=='NoTracking' ||

(workflow.scratchpad.task6Completed =='true' &&

(workflow.scratchpad.task5Completed =='true' || workflow.scratchpad.task5Completed = 'undefined'))){

2 REPLIES 2

Abhinay Erra
Giga Sage

Did you set the scratchpad variables before using them? What exactly are you seeing?


rlatorre
Kilo Sage

I see you need to use a double equals on the final condition.



== 'undefined'



or create all of your variables in the beginning of the workflow and set them to NULL to avoid using undefined variables.



workflow.scratchpad.task5Completed = '';