- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 12:08 AM
Hi Team,
I have got a requirement that, there is one field (Password) in the catalog item called "Password reset". After ticket creation, we generally see the password field in the Requester details under RITM form. In that RITM form I want it to be visible only for the specific group members. for rest of group members, it should be hidden in the Requester details section.
Conditions:
1. The field should be visible only to the specific assignment group members rest of members should be hidden.
I have tried creating a UI policies, but as the field is in the requester details, unable to select the field from the dropdown menu.
Can I know how can I achieve this?
Thanks in advance.
Nageshwari P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 01:23 AM - edited 07-17-2025 01:26 AM
Hello @nageswari1 ,
@Ankur Bawiskar has already outlined the approach quite well, but since you specifically asked for steps, here’s a clear breakdown that you can follow to achieve this:
Step 1: Create a System Property
This will help you manage the group visibility without modifying scripts later.
-
Name: x.company.visible.password.group
-
Type: String
-
Value: (Enter the Sys ID of the assignment group whose members should see the field)
Step 2: Create a Display Business Rule on sc_req_item
This rule checks whether the logged-in user is a member of the allowed group and stores a flag in g_scratchpad.
(function executeRule(current, previous) {
var allowedGroupSysId = gs.getProperty('x.company.visible.password.group');
var isVisible = false;
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('user', gs.getUserID());
groupMember.addQuery('group', allowedGroupSysId);
groupMember.query();
if (groupMember.hasNext()) {
isVisible = true;
}
g_scratchpad.show_password = isVisible;
})(current, previous);
Step 3: Create an onLoad Client Script on sc_req_item
Use this script to control the visibility of the variable using the scratchpad value.
function onLoad() {
// Replace 'new_password' with the name (not label) of your variable
g_form.setDisplay('variables.new_password', g_scratchpad.show_password);
}
🔹 Please mark ✅ Correct if this solves your query, and 👍 Helpful if you found the response valuable.
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 12:16 AM
you can use this approach
1) display business rule on sc_req_item, check if logged in user is member of that group store that flag in g_scratchpad variable
2) onLoad client script on sc_req_item table and use that scratchpad variable and use the syntax I shared below to show/hide variable
g_form.setDisplay('variables.variableName', true);
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 12:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 01:40 AM
I suggest to start from your side as it will be learning for you as well.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 01:23 AM - edited 07-17-2025 01:26 AM
Hello @nageswari1 ,
@Ankur Bawiskar has already outlined the approach quite well, but since you specifically asked for steps, here’s a clear breakdown that you can follow to achieve this:
Step 1: Create a System Property
This will help you manage the group visibility without modifying scripts later.
-
Name: x.company.visible.password.group
-
Type: String
-
Value: (Enter the Sys ID of the assignment group whose members should see the field)
Step 2: Create a Display Business Rule on sc_req_item
This rule checks whether the logged-in user is a member of the allowed group and stores a flag in g_scratchpad.
(function executeRule(current, previous) {
var allowedGroupSysId = gs.getProperty('x.company.visible.password.group');
var isVisible = false;
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('user', gs.getUserID());
groupMember.addQuery('group', allowedGroupSysId);
groupMember.query();
if (groupMember.hasNext()) {
isVisible = true;
}
g_scratchpad.show_password = isVisible;
})(current, previous);
Step 3: Create an onLoad Client Script on sc_req_item
Use this script to control the visibility of the variable using the scratchpad value.
function onLoad() {
// Replace 'new_password' with the name (not label) of your variable
g_form.setDisplay('variables.new_password', g_scratchpad.show_password);
}
🔹 Please mark ✅ Correct if this solves your query, and 👍 Helpful if you found the response valuable.
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024