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

 

1 ACCEPTED SOLUTION

If this answered you question please mark as helpful and correct.

View solution in original post

4 REPLIES 4

Brian Lancaster
Tera Sage

I have a similar 3 strike rule All I'm doing is waiting for a condition were state is not on hold and then doing an end flow. I am doing this instead of trying to use a script. Your flow should be running a Do the following in Parallel to work properly.

BrianLancaster_0-1713894589625.png

 

 

Hi @Brian Lancaster Thanks for your reply. I have changed my flow from script to your flow I'm using parallel flow, after every strike I'm using end flow activity, but here after strike 2 the flow is ending and if I'm initiating other incident like keeping on hold strike 1 again it was not cancelling the previous flow context. Here is my flow Please can you do the needful

rajeshKongamudi_0-1713930711091.png

 

 

After three strike is done I'm setting the flow auto resolved here at end

rajeshKongamudi_1-1713930760225.png

 

rajeshKongamudi_2-1713930800831.png

 

 

You should only have end flow on the ones that you want to cancel the flow. For example in the screenshots below I only use the 3 strike rule when the incident is on hold awaiting caller. So my first 2 do in Parallel are the only ones that end the flow except for when I get to the final set. First one looks for it so being take off hold and the second one looks for the hold reason to change to something else.

 

BrianLancaster_0-1713974142062.pngBrianLancaster_1-1713974179234.png

 

If this answered you question please mark as helpful and correct.