When the task is closed cancelled, then the RITM stage should be "request cancelled"

sunil kumar11
Tera Expert

When the task is closed cancelled, then the RITM stage should be "request cancelled" and the RITM state should be "closed cancelled" and cancelled notification should be sent out to the user.

3 REPLIES 3

Nayan  Dhamane
Kilo Sage
Kilo Sage

Hello @sunil kumar11 ,

You can do this by using an 'if' activity after task to check if the task state is closed cancelled if so then create a new activity to set the values of the RITM and end the workflow.

 

Let me know if you require more details or script to use in if activity.

Please mark correct.
BR,
Nayan

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

Please can you help me with any business rule

Nayan  Dhamane
Kilo Sage
Kilo Sage

Hello @sunil kumar11 ,

You can use business rule as well use the below script in business rule:

 

On after update business rule on 'sc_task' table

condition ; state changes to close cancelled

 

var elep = new GlideRecord('sc_req_item');

elep.addQuery('sys_id',current.request_item);

elep.query();

if (elep.next())

{

elep.state=‘2’; //put your state values

elep.stage=‘2’;

elep.setWorkflow(false);

elep.autoSysFields(false);

elep.update();

}

 

Note : If you want to cancel workflow use this line before update 'new Workflow().cancel(current)';

Please mark as correct.
BR,
Nayan.

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.