How to check if logged in User belongs to a particular group using Client Script or UI policy?

tyagisu
Mega Expert

Hi,

I need to make around 30 fields read-only on the change request form if the logged user doesn't belong to "XYZ" group. So only members of XYZ group can edit these 30 fields on the change request form after Authorize state.

I don't think I can write BR in this case as I need to make a change on the client side, so I was thinking to use OnLoad Client script for this, but then isMemberOf('XYZ') is not working on client script. Not sure about using ACL's for so many fields.

Any help would be appreciated!

Thanks in advance,

Su Tyagi

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

ACLs are probably the way to go here...even though it's a lot of fields.  The only way to deal with this client-side would be in a client script with a GlideAjax call to the server or via a display business rule.

'isMemberOf' is available server-side and can easily be used in an ACL.  Once you get the first one set up you can just insert and stay for the others.  Tedious at first, but probably best long-term.

If you do decide to do the check in a client script this post has a good solution.

https://community.servicenow.com/community?id=community_question&sys_id=18e01ba9dbdcdbc01dcaf3231f96...

Please mark this answer as correct if I've answered your question.  Thanks!

View solution in original post

2 REPLIES 2

Mark Stanger
Giga Sage

ACLs are probably the way to go here...even though it's a lot of fields.  The only way to deal with this client-side would be in a client script with a GlideAjax call to the server or via a display business rule.

'isMemberOf' is available server-side and can easily be used in an ACL.  Once you get the first one set up you can just insert and stay for the others.  Tedious at first, but probably best long-term.

If you do decide to do the check in a client script this post has a good solution.

https://community.servicenow.com/community?id=community_question&sys_id=18e01ba9dbdcdbc01dcaf3231f96...

Please mark this answer as correct if I've answered your question.  Thanks!

Thanks Mark!