- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 12:59 AM
Hi, I have created a service catalog item. When a user orders it, the request that is created should be assigned to a specific group. Please, help me achieve this.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 03:00 AM
Hi,
this should work
(function executeRule(current, previous /*null when async*/) {
var requestSysId = current.request; // this would give you sys_id so use sys_id in query below
var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id','=',requestSysId);
gr.query();
if(gr.next()){
gr.assignment_group = 'tttttttttttttttttttttttttttttt'; // HR group sys_id
gr.update();
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 02:13 AM
I prepared this code snippet but it does not work.
My Br configuration:
(function executeRule(current, previous /*null when async*/) {
// get request number from tirm record
var requestNumber = current.request;
var reqNumberOfRequest = '';
var req = current.request.getRefRecord();
// glide record on request table
var gr = new GlideRecord('sc_request');
gr.addQuery('number','=',requestNumber);
gr.query();
if(gr.next()){
req.assignment_group = 'tttttttttttttttttttttttttttttt'; // HR group sys_id
req.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 02:42 AM
Hi,
Your BR is on which table?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 02:51 AM
In sc_req_item table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2020 03:00 AM
Hi,
this should work
(function executeRule(current, previous /*null when async*/) {
var requestSysId = current.request; // this would give you sys_id so use sys_id in query below
var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id','=',requestSysId);
gr.query();
if(gr.next()){
gr.assignment_group = 'tttttttttttttttttttttttttttttt'; // HR group sys_id
gr.update();
}
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader