How to check logged in user is member of particular assignment group

Pravallika9
Tera Expert

Hi,

Requirement is I want company field to be editable only for the users who belongs to the assignment group whose type is xyz.

I am able to check whether the user is member of a particular group.

But here we have multiple groups for TYPE = XYZ.

how to acheive

 

 

 

3 REPLIES 3

Kartik Sethi
Tera Guru
Tera Guru

Hi @Pravallika 

 

What implementations you have done for your requirements?

 

Thanks and regards,

Kartik

Jonnala Babu
Kilo Contributor

HI Pravallika,

 

you need to figure out the groups he belongs to ,and then push them into array to find the type of the group is XYZ

 

and then proceed your script :

use :script include to get user groups :

 

 

Anil Lande
Kilo Patron

Hi,

You can use below script logic to check user membership of group of type XYZ.

var grpMem = new GlideRecord('sys_user_grmember');
grpMem.addEncodedQuery('group.typeLIKE'+sys_id_of_type);
grpMem.addQuery('user',gs.getUserID());
grpMem.query();
if(grpMem.hasNext()){
answer = true;
}else{
answer= false;
}

Replace sys_id of type in above script.

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande