File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Specialized Areas/Fix scripts/Nudge errored workflow Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * dirty fix to make workflow execute at wanted activity after error or wrong path for example
3+ * run as fix script or in bg.
4+ */
5+ var wfContextId = "ca1ba1bc83e83210557ff0d6feaad37d",
6+ wfActivityId = "b18321f083e83210557ff0d6feaad39d";
7+
8+ (function (wfContextId, wfActivityId) {
9+ //check valid context sysid
10+ var contextToFix = new GlideRecord("wf_context")
11+ if (!contextToFix.get(wfContextId)) {
12+ return null;
13+ }
14+ //set context state as executing
15+ if (contextToFix.getValue("state") != "executing") {
16+ contextToFix.setValue('state', 'executing');
17+ contextToFix.update();
18+ }
19+ //create instance of activity [wf_activity] to execute
20+ var activityToContinueFromGr = new GlideRecord("wf_executing");
21+ activityToContinueFromGr.newRecord();
22+ activityToContinueFromGr.setValue("context", wfContextId);
23+ activityToContinueFromGr.setValue("activity", wfActivityId);
24+ activityToContinueFromGr.setValue("state", "executing");
25+ activityToContinueFromGr.insert();
26+
27+ //send the update event to make the executing activity run
28+ new Workflow().broadcastEvent(wfContextId, 'update');
29+ })(wfContextId, wfActivityId)
You can’t perform that action at this time.
0 commit comments