Business rule to run when Additional comment changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 01:08 AM
Description : I have to create an event that fires when additional comments changes and the state does not changes to PUA or PU.
Solution implemented:
Business rule:
When to run :
state is one of = New,Pending Change, Pending Parts, Pending vendor, Work in Progress, Resolved.
OR
Additional comment changes.
Advavanced:
(function executeRule(current, previous /*null when async*/ ) {
if (current.state.changesTo(23) || current.state.changesTo(18)) {
current.setAbortAction(true);
} else {
if (current.comments.changes() && current.sys_updated_by == current.assigned_to.user_name) {
gs.eventQueue('Trigger_event_incident_comments', current, gs.getUserDisplayName(), current.comments);
} else if (current.comments.changes() && current.sys_updated_by == current.caller_id.user_name) {
gs.eventQueue('Trigger_event_incident_comments', current, gs.getUserDisplayName(), current.comments);
} else if (current.comments.changes() && current.sys_updated_by == current.watch_list.user_name) {
gs.eventQueue('Trigger_event_incident_comments', current, gs.getUserDisplayName(), current.comments);
}
}
})(current, previous);
Results:
The notification is triggering only when both additional comments have changed and state is changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 06:52 PM
Why would you have a state bias on a comment. Comments are intended to go to the customer no matter what.