- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 01:51 PM
I've been trying to get this script working, but I'm clearly getting something (or multiple somethings) wrong.
Goal: if the assignment group on an Incident is updated, then update additional comments saying "This ticket has been assigned to [assignment group selected]"
Table: Incident
Active: True
Advanced: True
before Update
Filter conditions: Assignment group | changes AND Assignment group | is not empty
Script:
(function executeRule(current, previous) {
// Get the assignment group information
var assignedGroup = new GlideRecord('assignment_group');
if (assignedGroup.get(current.assignment_group)) {
var assignmentGroup = assignedGroup;
// Add a comment with the assignment group
var comment = 'The ticket has been updated. Assigned to: ' + assignmentGroup;
current.comments = comment;
}
})(current, previous);
Can anyone see how to fix this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 02:01 PM
In a GlideRecord, the value in quotes following is a table name. assignment_group is not the name of a table, so this should be replaced with sys_user_group, but since Business Rules run on the server, you can dot-walk to the name of the group, so don't even need a GlideRecord. Your script can simply be:
(function executeRule(current, previous) {
// Add a comment with the assignment group
var comment = 'The ticket has been updated. Assigned to: ' + current.assignment_group.name;
current.comments = comment;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:00 AM
Works perfectly. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:53 AM
You are welcome!