- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 03:33 AM - edited ā03-25-2025 03:35 AM
based on below code i need to assign that specific group to catalog task assignment group field and i tested this code in background script sys_id is came but same code i executed on that time task assignment group is empty
var grpGR = new GlideRecord('sys_user_group');
grpGR.get("name","Mobile Services");
assignement_group = grpGR.sys_id + '';
check anyone let me know the mistake
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 04:15 AM
Hi @mani55 ,
Try this code
var grpGR = new GlideRecord('sys_user_group');
grpGR.addQuery('name', 'Mobile Services');
grpGR.query();
if (grpGR.next()) {
current.assignment_group = grpGR.getValue('sys_id'); // Get sys_id safely
gs.info('Assignment Group set to: ' + assignment_group);
} else {
gs.info('Group "Mobile Services" not found');
}
Try this ,
Thanks regards
Badrinarayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 03:39 AM
Is it via flow? How are you setting it? share screenshots.
how are you running the flow? Is the flow Running as System user
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 03:59 AM
trough script include i am setting assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 04:06 AM
please share the complete script i.e. from where are you calling this script include? workflow run script, flow inline script, business rule etc?
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-25-2025 04:15 AM
Hi @mani55 ,
Try this code
var grpGR = new GlideRecord('sys_user_group');
grpGR.addQuery('name', 'Mobile Services');
grpGR.query();
if (grpGR.next()) {
current.assignment_group = grpGR.getValue('sys_id'); // Get sys_id safely
gs.info('Assignment Group set to: ' + assignment_group);
} else {
gs.info('Group "Mobile Services" not found');
}
Try this ,
Thanks regards
Badrinarayan