Wait for condition getting cancelled everytime the condition meets

deepika46
Tera Contributor

Hello experts,

 

i Have a workflow and inside that workflow i have a wait for condition activity. Please find the code snippet below:

 

//START

 

// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
var gr_vm = new GlideRecord('u_vm_automation_scheduler');
gr_vm.addQuery('u_requested_item',current.sys_id);
gr_vm.query();
var processed = true;
if(gr_vm.next()){
if(gr_vm.u_status == 'Success' || gr_vm.u_status == 'Error'){
processed = true;
}else{
processed = false;
}
}
 
answer = processed;

//END

 

What is the script doing:

 

We have a table called "u_vm_automation_scheduler" and we have a status field which is originally in "ready" state. In my wait for activity, i am making the workflow to wait untill and unless the status field is Success or Error.(Script above). Whenever the Status becomes Success or Error, the Workflow rather than moving forward, it is getting cancelled everytime. Till the time the status field is  ready , the Wait for condition is waiting but as soon as the condition is meeting for sucess or error the workflow is instantly getting cancelled. Can anyone tell me what i am doing wrong.

 

Thanks in advance.

7 REPLIES 7

Hi @Brad Bowman  ,

 

Still no luck. the workflow is getting cancelled again. Is there any way i can debug this worfklow as why it is getting cancelled as soon as the condition is met. log also wont help over here i assume

@deepika46  what is the result when you check workflow context?

 

can you please share the screenshot of your workflow?

Is your workflow/ritm getting cancelled for any reason?

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

 

deepika46_1-1703607819967.pngdeepika46_2-1703607954282.png