The CreatorCon Call for Content is officially open! Get started here.

based on below code i need to assign that specific group to catalog task assignment group field

mani55
Tera Contributor

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

1 ACCEPTED SOLUTION

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@mani55 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

trough script include i am setting assignment group

@mani55 

please share the complete script i.e. from where are you calling this script include? workflow run script, flow inline script, business rule etc?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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