How to make variables editable for the users from a particular group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 04:16 AM
Hi All,
I have a requirement where two variables in RITM and SCTASK should be editable only for the users who are part of specific group and should be editable by admin as well.
Please help here.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 04:27 AM
Hi Kiruthika
You can use 'catalog UI policy' to make variables to be editable to any group.
mark my answer correct and helpful if if helps you to resolve the issue.
thanks
Rajesh.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 04:48 AM
This can be achieved without any scripting!
- Create a role
- Add the role to the group
- Add the role to 'write' for your variables (Permissions tab)
This solution is also scalable. If other groups need it, just add the role!
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:52 AM
Not through roles, Using group only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 05:59 AM
I would prefer solution shared by @The SN Nerd .
But if you wish to take other route then you can use Display BR on RITM and SC Task table
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.isMember = gs.getUser().isMemberOf('Group ABC'); // give your group name here
})(current, previous);
Then use onLoad normal client script on RITM and SC Task table and not catalog client script and script like this
function onLoad(){
if(g_scratchpad.isMember.toString() == 'true' || g_user.hasRoleExactly('admin')){
// do nothing
}
else{
g_form.setReadOnly('variables.variableName1', true);
g_form.setReadOnly('variables.variableName2', true);
}
}
OR
1) onLoad catalog client script which Applies on Requested Item and Applies on Catalog Task
2) use GlideAjax and check for group membership
I hope you can do this requirement considering the approach I gave.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader