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

Atul Kumar2
Giga Guru

Hi Kamlesh,



You need to check the workflow attached to this change request and you will have to tweak it.


Follow below details.



http://wiki.servicenow.com/index.php?title=Workflow_Concepts



Hope this helps you.



Regards,


Atul Kumar


you can add a approval activity after the catalog tasks in workflow like below:



Untitled.jpg


For details on workflow please go through the link Atul has provided


i followed this step but here i want if both task is completed then only it should go for approval.


but here without completing this both task it is going to approval requested


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