- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi,
There is a Flow on a catalog item, i want flow to move forward when an additional comment is added to the RITM.
but when i use the wait for condition, i cannot select comments/additional comments as a field, or any other journal field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Lowestoft,
You can achieve this functionality by using the "Wait for Message" action in your Flow, which allows the flow to pause until it receives a specific message via the Flow API. Unfortunately, journal fields like Comments or Additional Comments aren’t directly selectable in the "Wait for Condition" action, so this approach is a reliable alternative.
Here are the steps to implement:
- Add a "Wait for Message" action in your flow:
Set Message to "Resume Flow".
- Set Enable timeout & Timeout (optional)
(only if you want to resume the flow if no message is received after a specific amount of time)
Create an After Update Business Rule on the Requested Item[sc_req_item] table:
Name it something like "Resume Flow - RITM Additional Comment".
Set the filter condition to check if Comments have changed.
Check Advanced and add the following script in the Script field:
(function executeRule(current, previous /*null when async*/ ) {
try {
var lastComment = current.comments.getJournalEntry(1);
var result = sn_fd.FlowAPI.sendMessage(current.flow_context, "Resume Flow", lastComment);
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})(current, previous);
Now, when the flow reaches the "Wait for Message" action, it will pause.
Once an additional comment is added to the RITM, the business rule will trigger and send the "Resume Flow" message.
Refresh the flow execution, and you will see the flow resumes and continues processing.
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Lowestoft,
You can achieve this functionality by using the "Wait for Message" action in your Flow, which allows the flow to pause until it receives a specific message via the Flow API. Unfortunately, journal fields like Comments or Additional Comments aren’t directly selectable in the "Wait for Condition" action, so this approach is a reliable alternative.
Here are the steps to implement:
- Add a "Wait for Message" action in your flow:
Set Message to "Resume Flow".
- Set Enable timeout & Timeout (optional)
(only if you want to resume the flow if no message is received after a specific amount of time)
Create an After Update Business Rule on the Requested Item[sc_req_item] table:
Name it something like "Resume Flow - RITM Additional Comment".
Set the filter condition to check if Comments have changed.
Check Advanced and add the following script in the Script field:
(function executeRule(current, previous /*null when async*/ ) {
try {
var lastComment = current.comments.getJournalEntry(1);
var result = sn_fd.FlowAPI.sendMessage(current.flow_context, "Resume Flow", lastComment);
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})(current, previous);
Now, when the flow reaches the "Wait for Message" action, it will pause.
Once an additional comment is added to the RITM, the business rule will trigger and send the "Resume Flow" message.
Refresh the flow execution, and you will see the flow resumes and continues processing.
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thanks Muhammad, was not too sure how API message can be sent, so this approach of sending it via business rule seems to be the only option.
