Three strike automation on incident form

rajeshKongamudi
Tera Contributor

Hi, We are facing some issue on the incident three strike policy when we kept incident state as on hold and on hold reason kept as strike 1 and 2 and 3 manually an notifications will be triggers but here we are doing some automation if the user does not replied until 2 business days it goes to the strike 1 and then strike 2...... so here We are unable to cancel the previous flow context records After the on hold reason is kept in progress by the affected user in between flows and it is interrupting the flow here is the cancel action we have added. can someone please help us to get this issue resolved.

Code for cancelling the previous context flows: 

(function execute(inputs, outputs)
{
var gr = new GlideRecord('sys_flow_context');
gr.addQuery('source_record', inputs.parameter_id);
gr.addQuery('sys_id', inputs.sysid);
gr.addEncodedQuery('stateINWAITING,IN_PROGRESS,QUEUED');
gr.orderByDesc('sys_created_on');
gr.query();
while (gr.next())
{
sn_fd.FlowAPI.cancel(gr.getUniqueValue(), 'Flow took too long to execute');
outputs.parameter_output = 'success';
 }
})(inputs, outputs);
 
 
rajeshKongamudi_0-1713893843728.png

 

 

rajeshKongamudi_1-1713893872413.png

 

rajeshKongamudi_2-1713893919446.png

 

rajeshKongamudi_3-1713893956069.pngrajeshKongamudi_4-1713893975286.png