how to generate the approval after completion of all the task in the change

kamleshrathore
Kilo Contributor

hi team ,

i want to generate the approvals in the approvers tab in the change form after

completion of all the four task as given below in the screen shot.

find_real_file.png

find_real_file.png

here i dont want to keep the condition in the task like first task completed then second task should open.

here my all task going to generate together and here i want once all the task completed then approval should generate

plz help me

1 ACCEPTED SOLUTION

Mihir Mohanta
Kilo Sage

1. In the workflow add a workflow condition activity that will wait till all tasks related to that change completed. and connect output of that activity to approval user/approval group activity.



find_real_file.png



Script inside the wait for condition activity should be like,



// Set the variable 'answer' to true or false to indicate if the condition has been met or not.


//answer = true;


var gr_tsk = new GlideRecord("change_task");


gr_tsk.addQuery('change_request', current.sys_id);


gr_tsk.addQuery('state','!=', 24);


gr_tsk.addQuery('state','!=', 3);


gr_tsk.query();


if (gr_tsk.next()) {


    answer = false;


} else {


    answer = true;


}




Thanks,


Mihir


View solution in original post

6 REPLIES 6

I think you'll find you will have issues with stalled workflows with this approach - because updates on a Change Task are not always going to trigger an update on the Change workflow and cause the Wait condition to be evaluated.


Geoffrey2
ServiceNow Employee
ServiceNow Employee

It sounds to me like you just need a basic Join Activity.   All Tasks have Wait for completion as true.   The workflow effectively waits at the Join Activity until all paths reach it, and then it continues to the Approval.


Screen Shot 2016-10-07 at 8.34.56 PM.png