how can i fetch groups in to an array

lakng
Tera Contributor

i want to fetch few groups in an array,

after that if the change request is having approval for this groups the Approval automatically has to set No longer Required.

so here how can i write an business rule, which will check the approval group, if the approval group is one of these fetched ones, then the approval has to set "No longer Required"

 

1 ACCEPTED SOLUTION

Hi,

so can you add a log above if and print current.assignment_group and groups array and check what the value it contains.

Technically,both should be group sys_ids and if you think the assignment group present in your list of groups, then manually verify the sys_id of assignment group in the groups array or in your table.

Mark the comment as a correct answer and helpful if it helps.

View solution in original post

48 REPLIES 48

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you share the script here which is not working as expected?

Regards

Ankur

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

i have not written any till now. am asking someone to help with scripting for this requirement in business rule

Chavan AP
Kilo Sage

hi ,

Please refer below:

var grp= new GlideRecord('sys_user_group');
grp.addActiveQuery();
grp.query();


while(grp.next())
	{
		
   var grpArray = [];
				grpArray.push(grp.getDisplayValue('name'));

	}

gs.log(grpArray.join(','));

 

Regards

aj

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****