- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 02:11 AM
Hi, I need help with restricting the Variable formatter for certain group for one of the Catalog Item. My requirement is to make the Variable Formatter to be editable only for certain members of the group for rest all others it shouldn't be editable. I need to achieve this via Catalog Client Script. After submitting the request, in the backend Variables should be only editable for certain group and others shouldn't be able to edit.
Any inputs here?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 03:18 AM
Follow the below steps.
1. Write display BR on req item table
Condition : item is "select catalog name"
Script:
Result:
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 02:32 AM
Hi @Appu2 ,
To restrict a variable formatter to be editable only for certain members of a group for a catalog item in ServiceNow, you can achieve this by using a Catalog Client Script. The script will need to check if the current user belongs to the specified group, and if they do, allow them to edit the variable; otherwise, restrict access.
Here's an example of how you can create such a Catalog Client Script:
-
Navigate to "Service Catalog" > "Catalog Client Scripts" in your ServiceNow instance.
-
Click on "New" to create a new Catalog Client Script.
-
Provide a suitable name and description for your script.
-
In the "Script" field, you can use JavaScript to restrict variable editing based on the user's group membership.
Here's an example script:
(function () {
// Define the group name that is allowed to edit the variable
var allowedGroup = 'YourGroupName'; // Replace with your group name
// Check if the current user is a member of the allowed group
var user = gs.getUser();
if (!user.isMemberOf(allowedGroup)) {
// If not a member, disable the variable for editing
g_form.setReadOnly('variable_name', true); // Replace 'variable_name' with the actual variable name
}
})();
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 02:57 AM
"gs" will not work in Client Script.
Any other solution for this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 03:05 AM
on which table you want to set variable editor readonly?
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2023 03:07 AM
sc_req_item table in which for only specific Catalog Item