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.

How to set workflow false in scoped application when a user cancel the request.

Vishnu priya2
Tera Contributor

Hi All,

I have created a scoped application. When a user cancel the request in approval state ,my task and approvers(which is from related list) should be cancelled.I have created a custom table for task.Providing you the BR and Script Include screenshot.Kindly help me with the solution.

 

Thanks,

Vishnu Priya V 

Vishnupriya2_0-1691591899708.pngVishnupriya2_1-1691591945220.png

 

1 REPLY 1

sushantmalsure
Mega Sage

I believe the script must not be working .

and its not working because in script include you are missing iterator:

add following

replace line 11 to 13 with

while(gtask.next()){

gtask.state = '4';

gtask.setWorkflow(false);

gtask.update();

}

 

and replace line 22 to 24 with following:

 

while(gapp.next()){

gapp.state = 'cancelled';

gapp.setWorkflow(false);

gapp.update();

}

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure