- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 01:05 AM
Morning,
I am trying to get a business rule on the sc_req_item table to pass the details of the current updated record into a Sub Flow, but i am clearly not formatting the input correctly, as the flow is erroring, as it is not passing the current record details I have tried "current.sc_req_item.sys_id" aswell with the same issue
This is the script I have on the Requested Item business rule:-
(function() {
try {
var inputs = {};
inputs['ritm'] = current.sc_req_item; // GlideRecord of table: sc_req_item
// Start Asynchronously: Uncomment to run in background. Code snippet will not have access to outputs.
// sn_fd.FlowAPI.getRunner().subflow('global.vonage__add_interaction_to_existing_ritm').inBackground().withInputs(inputs).run();
// Execute Synchronously: Run in foreground. Code snippet has access to outputs.
var result = sn_fd.FlowAPI.getRunner().subflow('global.vonage__add_interaction_to_existing_ritm').inForeground().withInputs(inputs).run();
var outputs = result.getOutputs();
// Current subflow has no outputs defined.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
If I test the flow directly by selecting a ritm, the flow executes correctly, so I knwo it is purely related to the Business Rule
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 01:34 AM
Hi @jonathangilbert ,
Just pass the current object as input, as you are running the BR on RITM (sc_req_item) table itself. The current object itself is RITM record.
And you are calling the sub flow two times, once in background and again in fore ground. Use any one, either Background or Foreground. That is why it is causing the duplicate record and failing the sub flow in first step itself.
The below script calls the sub flow in background.
try {
var inputs = {};
inputs['ritm'] = current; // GlideRecord of table: sc_req_item
sn_fd.FlowAPI.getRunner().subflow('global.vonage__add_interaction_to_existing_ritm').inBackground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
Can you please confirm what kind of business rule you are using (After - Insert | Before - Insert | After - Update etc.)? So that I can provide the exact script.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 01:34 AM
Hi @jonathangilbert ,
Just pass the current object as input, as you are running the BR on RITM (sc_req_item) table itself. The current object itself is RITM record.
And you are calling the sub flow two times, once in background and again in fore ground. Use any one, either Background or Foreground. That is why it is causing the duplicate record and failing the sub flow in first step itself.
The below script calls the sub flow in background.
try {
var inputs = {};
inputs['ritm'] = current; // GlideRecord of table: sc_req_item
sn_fd.FlowAPI.getRunner().subflow('global.vonage__add_interaction_to_existing_ritm').inBackground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
Can you please confirm what kind of business rule you are using (After - Insert | Before - Insert | After - Update etc.)? So that I can provide the exact script.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 04:33 AM
Thats brilliant, thank you for that. I just took the original code as the code snippet from the flow, but it was useful to know. It works perfectly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 03:29 AM
Hi Avinash,
I need to trigger the same process for sc task. Do we need to pass the task parent record to the Requested Item in flow designer?.
What is the input[‘ritm’] refers over here?. Do we need to use input[‘ritm’]=current.parent from the sc-task table on the business rule?.