- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 07:04 AM
Hi
Why: We want all customer interaction to happen through the related Case record.
How: Business Rule on both the Incident and Case table (also tried on the task table, with same issue).
Issue: The code works, but since it is generating a loop on the source record, that record get's two entries in the Comments section. One from the Source table (where the user enters the comment or email) and then one from the replicating table (for instance Incident). Then the BR seems to stop (as it either seems to detect a loop, or no changes are made to the "additional comments" field. In the case above Case will have to identical Comments while the Incident has one. If the update happens on the Incident table the INC will have two identical comments, and case will have only one.
How can I correct this looping behaviour?
I've tried matching the comments with getJournalEntry(1), but they seem to mismatch at all times.
Is the answer to create an additional field u_last_comment and match that field to the last JournalEntry? Anyone have any good ideas? 🙂
Bussiness rules are running;
When; before
On: Update
Filters: Additional comments = changes
State = not closed/cancelled
Business Rule on Case table
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', current.incident.sys_id);
inc.addQuery('state','NOT IN',ServiceManagementIntegrationConstants.NO_INC_SYNC_CASE_STATE.join());
inc.query();
while (inc.next()) {
inc.comments = current.comments;
inc.update();
}
})(current, previous);
Business Rule on Incident Table
(function executeRule(current, previous /*null when async*/) {
var cs = new GlideRecord('sn_customerservice_case');
cs.addQuery('incident', current.sys_id);
cs.addQuery('state','NOT IN',ServiceManagementIntegrationConstants.NO_INC_SYNC_CASE_STATE.join());
cs.query();
while (cs.next()) {
cs.comments = current.comments;
cs.update();
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 07:10 AM
Hey,
Add gs.getSession().isInteractive() in the condition field of the BR and try it might solve the issue.
If this has helped you in anyway please mark the reply as helpful/correct.
Regards,
Prashanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2021 07:10 AM
Hey,
Add gs.getSession().isInteractive() in the condition field of the BR and try it might solve the issue.
If this has helped you in anyway please mark the reply as helpful/correct.
Regards,
Prashanth