- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2023 11:49 AM
Hi Experts
I have the requirement, When I select the any group name on my sc_req_item table that same group name should be on my sc_task table assignment group dynamically . How to achieve this task.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2023 12:23 PM
Please write a business rule as follows:
Script:
if(current.variables.group != previous.variables.group){ /backend name of group please check
var gr = new GlideRecord("sc_task");
gr.addEncodedQuery("request_item=" + current.sys_id);
gr.query();
while(gr.next()){
gr.assignment_group = current.variables.group; //please check backend name of group
gr.update();
}
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2023 12:11 PM - edited 04-08-2023 02:54 PM
Hi,
You could use a business rule defined on the sc_req_item table, that updates the assignment_group on those sc_task records And use the following script:
// update related task with he assignment group
var scTask = new GlideRecord('sc_task');
scTask.addQuery('request_item', current.sys_id.toString());
scTask.query();
while (scTask.next()) {
//see if group on related task needs changing
if (scTask.assignment_group != current.assignment_group) {
gs.addInfoMessage("Setting assignment group: " + current.assignment_group.getDisplayValue() + " for " + scTask.number);
scTask.assignment_group = current.assignment_group;
scTask.update();
}
}
in the body of the script. I would configure the BR to run on Update and Insert, and to run "After". And a condition of "Assignment group", "changes"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2023 12:23 PM
Please write a business rule as follows:
Script:
if(current.variables.group != previous.variables.group){ /backend name of group please check
var gr = new GlideRecord("sc_task");
gr.addEncodedQuery("request_item=" + current.sys_id);
gr.query();
while(gr.next()){
gr.assignment_group = current.variables.group; //please check backend name of group
gr.update();
}
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.