Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Server-Side Components/Business Rules/Start a Flow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Start a flow asynchronously from Workflow Studio using a business rule.
sn_fd.FlowAPI.getRunner().flow('global.flowName').inBackground().withInputs(inputs).run();
19 changes: 19 additions & 0 deletions Server-Side Components/Business Rules/Start a Flow/script.js
Original file line number Diff line number Diff line change
@@ -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);
Loading