- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 10:37 PM
Hi all,
I have a scenario:
in incident form, if the priority changes to 1, a new incident should be created with the same details of the current incident but the assigned to should be the 'manager of the assignment group'. the incident is getting created but assigned to is not getting updated.
I've written an after BR with conditions.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 11:40 PM
Hello @abjaffrey ,
You can use this to achieve your requirement.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var newInc = new GlideRecord('incident');
var assignment = current.assignment_group.manager;
newInc.initialize();
newInc.description = 'This is created as the priority was changed to 1'+'\n'+current.description;
newInc.assignment_group = current.assignment_group;
newInc.impact = 1;
newInc.urgency = 1;
newInc.assign_to = assignment; //This will set the manager in assigned_to field.
newInc.caller_id = current.caller_id;
newInc.category = current.category;
newInc.short_description = current.short_description;
newInc.assigned_to = assignedTo;
newInc.insert();})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:44 AM
Hi @abjaffrey ,
There is a minor mistake in your code, in the following section. I have commented down the correct condition and highlighted it with bold font. Change "grpDetails.name" to "grpDetails.sys_id" and your code should work.
===============================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 11:40 PM
Hello @abjaffrey ,
You can use this to achieve your requirement.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var newInc = new GlideRecord('incident');
var assignment = current.assignment_group.manager;
newInc.initialize();
newInc.description = 'This is created as the priority was changed to 1'+'\n'+current.description;
newInc.assignment_group = current.assignment_group;
newInc.impact = 1;
newInc.urgency = 1;
newInc.assign_to = assignment; //This will set the manager in assigned_to field.
newInc.caller_id = current.caller_id;
newInc.category = current.category;
newInc.short_description = current.short_description;
newInc.assigned_to = assignedTo;
newInc.insert();})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2024 02:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:44 AM
Hi @abjaffrey ,
There is a minor mistake in your code, in the following section. I have commented down the correct condition and highlighted it with bold font. Change "grpDetails.name" to "grpDetails.sys_id" and your code should work.
===============================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2024 02:56 AM