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"

 

Ankur Bawiskar
Tera Patron

Hi,

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

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x 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

Ajay_Chavan
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*****