- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 05:11 AM
Hello All,
Can anyone help me to review the simple code that i have written to fetch the assignment group manager to approve the requested item and then it should generate the catalog task?
I am using Approval User activity and have written below code.
var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id', current.variables.assignment_group);
gr.query();
if (gr.next()) {
var name = gr.manger.toString();
gs.log("please find the name of the manger" + name);
answer.push(name);
}
Tried using via attached configurable way as well but it is still not working and approval user activity seems to be skipped and it generates the catalog task.
I have checked and the manager field is populated in the sys_user_group form.
Thanks
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 10:21 PM
Hi Abhijeet,
Since I answered your initial query successfully. I request you to mark my above response as correct. As far as your new code is concerned it should be as below
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.group = current.variables.assignment_group;
gr.user = current.variables.requested_for;
gr.insert();
gs.log("User " + current.variables.requested_for + " has been added to group " + current.variables.assignment_group);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 09:23 AM
I don't think I have kept those two line:
gr.addQuery('group',current.variables.assignment_group);
gr.query();
if(gr.next()){
Please copy my code as it is and paste
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 06:18 AM
Thank you for your response. my issue is resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 10:21 PM
Hi Abhijeet,
Since I answered your initial query successfully. I request you to mark my above response as correct. As far as your new code is concerned it should be as below
var gr = new GlideRecord('sys_user_grmember');
gr.initialize();
gr.group = current.variables.assignment_group;
gr.user = current.variables.requested_for;
gr.insert();
gs.log("User " + current.variables.requested_for + " has been added to group " + current.variables.assignment_group);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 06:18 AM
Thank you for your help. Issue is resolved