- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2022 02:03 AM
How to compare manager of requested_by with assignment group manager .need to check if both the managers are same or not.Thanks you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 07:15 AM
Hi,
You can try this out.
var group_rec;
var glide = new GlideRecord('sys_user_group');
glide.addQuery('group', record.assignment_group);
glide.query();
while (glide.next()) {
group_rec = glide.group;
var group = new GlideRecord('sys_user_group');
if(group.get(group_rec)){
//group object can be accessed here by dotwalkin on group variable
gs.info("Name: "+group.name);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 07:22 AM
Simply Query the sys_user_group table as below, if all you wanted was a Group Object by a sys_id of the Group.
var groupGr = new GlideRecord('sys_user_group');
groupGr.get(record.assignment_group);
ig(groupGr){
var group_rec = groupGr;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 07:26 AM
Use any of the below two ways.
var id = ""; // sys_id of the group
var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id',id);
gr.query();
if(gr.next()) {
gs.info('Group Object - '+gr);
}
-------
var id = ""; //sys_id of the group
var gr = new GlideRecord('sys_user_group');
gr.get(id);
gs.info('Group Object' +gr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2019 07:57 AM
Hi
Your script looks good. So, the reason, why it does not work is, that
a) "record" does not contain a valid GlideRecord
b) "record" does not have the field "assignment_group"
c) the value of the field "assignment_group!" does not have a Relation to the "group" table, but maybe has only a String
Can you confirm, that the above three points are correct?
Let me know, if that solved your issue, and mark my answer as correct and helpful,please.
BR
Dirk