Workflow - "Wait for Condition" activity

roomawakar
Tera Contributor

Hi All,

 

I have put the Wait for Condition activity in the workflow with the condition:

 

1. Approval is Approved

2. A particular catalog task should be closed

 

then only the workflow should move forward but the WF is not moving forward. The WF is getting stuck at the Wait for Condition.

 

Can someone please tell me what is the issue and how that can be fixed?

 

Thanks,

Rooma

12 REPLIES 12

@Brad Bowman  Its not working.

Ankur Bawiskar
Tera Patron
Tera Patron

@roomawakar 

workflow wait for condition will proceed only when update happens on RITM.

Since you are waiting on some other record it won't work directly.

Do this -> mimic update on RITM

1) have after update BR on sc_task

Condition: current.request_item.cat_item.name == 'Your Item' && Active [Changes to] False && Short Description [STARTS WITH] Review Request

Script:

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var wf = new Workflow();
    var ri = new GlideRecord("sc_req_item");
    if (ri.get(current.request_item)) {
        wf.runFlows(ri, 'update');
    }

})(current, previous);

Also workflow wait for condition requires answer = true/false

If answer=true it will proceed as condition is met

So instead of returning yes or no, return boolean true and false in your script

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar Its not working even I created the BR and set the answer as True.

@roomawakar 

it should work fine.

what debugging did you do?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I ran the workflow script in the background script and it is returning true. Other than that I am not sure how and where to debug.