From 326d593395486f218b36f1831d6cf21e614998e5 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:05:48 -0500 Subject: [PATCH 1/5] Create Start a flow --- Server-Side Components/Business Rules/Start a flow | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Server-Side Components/Business Rules/Start a flow diff --git a/Server-Side Components/Business Rules/Start a flow b/Server-Side Components/Business Rules/Start a flow new file mode 100644 index 0000000000..5f8465596b --- /dev/null +++ b/Server-Side Components/Business Rules/Start a flow @@ -0,0 +1,3 @@ +Start a flow asynchronously from Workflow Studio using a business rule. + sn_fd.FlowAPI.getRunner().flow('global.flowName').inBackground().withInputs(inputs).run(); +Cancel a flow using the context ID returned from the flow method From f05895655d1b17aca244f72c1f4167f4fb34dc3a Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:09:16 -0500 Subject: [PATCH 2/5] Delete Server-Side Components/Business Rules/Start a flow --- Server-Side Components/Business Rules/Start a flow | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Server-Side Components/Business Rules/Start a flow diff --git a/Server-Side Components/Business Rules/Start a flow b/Server-Side Components/Business Rules/Start a flow deleted file mode 100644 index 5f8465596b..0000000000 --- a/Server-Side Components/Business Rules/Start a flow +++ /dev/null @@ -1,3 +0,0 @@ -Start a flow asynchronously from Workflow Studio using a business rule. - sn_fd.FlowAPI.getRunner().flow('global.flowName').inBackground().withInputs(inputs).run(); -Cancel a flow using the context ID returned from the flow method From 45d65e4f80ac93ee4b8ef297d9329b0efff545dd Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:10:26 -0500 Subject: [PATCH 3/5] Create README.md --- Server-Side Components/Business Rules/Start a Flow/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Server-Side Components/Business Rules/Start a Flow/README.md diff --git a/Server-Side Components/Business Rules/Start a Flow/README.md b/Server-Side Components/Business Rules/Start a Flow/README.md new file mode 100644 index 0000000000..5f8465596b --- /dev/null +++ b/Server-Side Components/Business Rules/Start a Flow/README.md @@ -0,0 +1,3 @@ +Start a flow asynchronously from Workflow Studio using a business rule. + sn_fd.FlowAPI.getRunner().flow('global.flowName').inBackground().withInputs(inputs).run(); +Cancel a flow using the context ID returned from the flow method From c1f986031d544a897e678b98da5a5e34f8529968 Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:22:48 -0500 Subject: [PATCH 4/5] Create script.js --- .../Business Rules/Start a Flow/script.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Server-Side Components/Business Rules/Start a Flow/script.js diff --git a/Server-Side Components/Business Rules/Start a Flow/script.js b/Server-Side Components/Business Rules/Start a Flow/script.js new file mode 100644 index 0000000000..40d18e73f0 --- /dev/null +++ b/Server-Side Components/Business Rules/Start a Flow/script.js @@ -0,0 +1,19 @@ +//Table: Change Task +// When: After Delete +// When any of the associated change tasks are deleted, calling the flow asynchronously to make the updates. +(function executeRule(current, previous /*null when async*/ ) { + try { + var chgTask = new GlideRecord('change_task'); + chgTask.addQuery('change_request', current.change_request); + chgTask.query(); + if (chgTask.next()) { + var inputs = {}; + inputs['current'] = chgTask; + inputs['table_name'] = 'change_task'; + sn_fd.FlowAPI.getRunner().flow('global.calculateActualStartEndDates').inBackground().withInputs(inputs).run(); + } + } catch (ex) { + var message = ex.getMessage(); + gs.error(message); + } +})(current, previous); From c47c238c9b6fb18e13e995b141de5bcda619faab Mon Sep 17 00:00:00 2001 From: HackoDev1530 <92592691+HackoDev1530@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:23:09 -0500 Subject: [PATCH 5/5] Update README.md --- Server-Side Components/Business Rules/Start a Flow/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Server-Side Components/Business Rules/Start a Flow/README.md b/Server-Side Components/Business Rules/Start a Flow/README.md index 5f8465596b..c0d1050023 100644 --- a/Server-Side Components/Business Rules/Start a Flow/README.md +++ b/Server-Side Components/Business Rules/Start a Flow/README.md @@ -1,3 +1,2 @@ Start a flow asynchronously from Workflow Studio using a business rule. sn_fd.FlowAPI.getRunner().flow('global.flowName').inBackground().withInputs(inputs).run(); -Cancel a flow using the context ID returned from the flow method