How do we cancel an executing Flow Context (any table) when a particular condition is met ?
We have an OOTB "Cancel" UI action on the "sys_flow_context" table to cancel the flow.
But instead doing it manually every time on a record, we can write a Business rule and define it on the table where the flow has to be cancelled and include the conditions on when to run.
The Script inside the business rule will be:
var referer = GlideTransaction.get().getRequest().getHeader("referer");
var gpa = new sn_ph.GlideProcessAutomation(current.sys_id);
gpa.cancel("manually by " + gs.getSession().getUserName());
All Flow Designer supported versions