
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2021 03:11 AM
Hi All,
I was given a task to create a new catalog item and one of the requirements is that some variable fields should be only visible to a certain group members. I'm trying to create a script in the Catalog UI Policy to do this, what I need to do is to get servicenow read if the current logged in user is a member of a certain group and if he/she is then some variable fields should be visible to them. Can anyone help as to how I can achieve this? I'm still new to this so I'm not really sure how this should work.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2021 11:10 PM
Okay this is what it should have returned to you.
Now can you make sure you have given the correct variable names in your script. It should be the backend Name of the variable.
Can you share screenshot of your variable form which shows the name to make sure that has been entered is correct.
Like for example in my case, my current logged in user is part of two groups as shown below:
Now in my script I am checking if User is part of "Team Development Code Reviewers" queue then I am hiding my Variables 1 and Variables 2
This hides both my Variables on the form. For reference I have attached my Variable form screenshot as well below to make sure the name added to your script is the name highlighted:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2021 11:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2021 11:10 PM
Okay this is what it should have returned to you.
Now can you make sure you have given the correct variable names in your script. It should be the backend Name of the variable.
Can you share screenshot of your variable form which shows the name to make sure that has been entered is correct.
Like for example in my case, my current logged in user is part of two groups as shown below:
Now in my script I am checking if User is part of "Team Development Code Reviewers" queue then I am hiding my Variables 1 and Variables 2
This hides both my Variables on the form. For reference I have attached my Variable form screenshot as well below to make sure the name added to your script is the name highlighted:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2021 12:09 AM
Hi
I think it did worked, I just impersonated a user that is part of the "Hardware" group and it did hid the variables. Although what I need is to make some variable visible to let's say the members of "Hardware" group and if the logged in user is not a member of the said group then it should be hidden. What I just did is set the 2 variables hidden first and if the logged in user is a part of the defined group, then the variables will be set to true instead of false. Although I need to do this same thing in a Multi-row variable set. Do you think it should work there as well?
Also THANK YOU SO MUCH FOR YOUR HELP! I'm really having a difficult time figuring this out as I'm still learning about the scripts. I really appreciate your time helping out! 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2021 12:21 AM
Nope unfortunately this is not possible with Multi Row Variable Set . Please refer to below HI Article from ServiceNow:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0960829
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2022 06:26 AM
Solution helped me for one of the similar requirement.
Thanks Alot Shloke.