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.

Reevaluating Flow Hr Activity set trigger check

Echa Med
Tera Guru

Putting this here so someone doesn't waste too much time on it.

With workflows, you could force a reevaluation of activity set triggers using the script below (available in the "Condition with Event BR (Demo)" business rule if you have it) : 

	(function executeRule(current, previous /*null when async*/) {
		var wf = new global.Workflow().getRunningFlows(current);
		while (wf.next()) {
			if (wf.getValue('name') == 'HR Activity Set Trigger Check')
				new global.Workflow().broadcastEvent(wf.sys_id, 'check_activity_set_trigger');
		}
	})(current, previous);

But, since moving almost everything to flows, this does not work anymore.

You can fix this tho by simply changing the flow name from "HR Activity Set Trigger Check" to "Wait for Workflow Event". The new script looks like this : 

(function executeRule(current, previous /*null when async*/) {
	var wf = new global.Workflow().getRunningFlows(current);
	while (wf.next()) {
		if (wf.getValue('name') == 'Wait for Workflow Event')
			new global.Workflow().broadcastEvent(wf.sys_id, 'check_activity_set_trigger');
	}
})(current, previous);

You can check the activity set trigger subflows if you're curious about the details

0 REPLIES 0