Find assigned to is member of particular group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 04:37 AM
Hi All,
I have assigned to field referencing to user table. Now I want to check if the Assigned to user is part of "BCKAM -200&210" group. If Yes I have to clear Assignment group field value.
Please suggest any solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 04:44 AM
Hi @Dileep2 ,
Follow the below script
var user = current.assigned_to;
var group = "abc";//this should be sysid of the group BCKAM
//You can directly use .isMemberOf("group name") to check whether the user is part of the group or not.
var groupMember = new GlideRecord("sys_user_grmember");
groupMember.addQuery("group",group);
groupMember.addQuery("user",user);
groupMember.query();
if(groupMember.next()){
current.assignment_group = " " ;//Emptying the assignment group
current.update();
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 04:48 AM
Hello @Dileep2 ,
You can do it like this if you doing this in before BR
if(current.assigned_to.isMemberOf('your_group_name')==true)
{
current.assignment_group ="";
}
Hope this helps
Mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 04:51 AM
Hi Dileep ,
You need to first decide on what event you need to have a check for this. On change of assigned to field or on submission of the record.
If you need to do client side validation in that case you will need to have script include call from your onchange client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 12:33 AM
Hi Anubhav,
Thanks for the solution, I followed the same but I am not sure what to write in the code. I want OnChange of Assigned to field,
Please post me code
Thank you