Requester details field hiddenin the RITM and SCTASK form.

nageswari1
Tera Contributor

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.

1 ACCEPTED SOLUTION

Aniket Chavan
Tera Sage
Tera Sage

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

View solution in original post

18 REPLIES 18

Hi @Aniket Chavan,

 

I have accepted your earlier solution. Thank you so much for your support.
Can you please go through my other article once and check. It will be helpful.
Hide Requester details field in RITM and SCTASK fo... - ServiceNow Community

 

Best Regardsm

Nageshwari P.

Hello @nageswari1 / @Nageshwari P , just tagging you here as well so you don’t miss it this time 😅. And hey, if this helps, don’t forget to hit that Helpful and mark my solution as accepted toooooo 🙌

 

I had some time so I tried to implement the functionality myself since I already had the setup in my PDI from our earlier thread. While searching around, I saw multiple suggestions saying to create a "sys_popup" view to get around this issue. I tried that as well, but nothing really worked.

 

After digging more, I came across an official KB (last updated in 2024) where it’s clearly mentioned that this issue cannot be resolved with the "sys_popup" approach. The only possible resolution is through ACLs, but even that is currently out of scope for ServiceNow. Basically, no BR or client script works on the preview UI, and as per the KB, it’s also not possible right now to directly exclude a specific variable with ACLs.

 

So, the only way I can suggest to make this work (even with some customization) is:

  • Hide the variable on RITM & SCTASK using a UI policy, so it only shows when the value is being filled on the portal form.

  • Once submitted, map that value into a custom field (say New Password).

  • Then, apply an ACL on that field with an advanced script to check if the logged-in user belongs to the right group, and control visibility from there. No need for BRs or client scripts in that case.

Here’s the ACL script I tested and it works fine:

 

// Replace with your group sys_id
var targetGroupSysId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';

// Get GlideRecord for sys_user_grmember
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', gs.getUserID());
gr.addQuery('group', targetGroupSysId);
gr.query();

// Return true if user is in the group, else false
if (gr.next()) {
    answer = true; // user has access
} else {
    answer = false; // user denied
}

 

 

AniketChavan_0-1755875870923.png
Scenario when I was present inside the group:

AniketChavan_1-1755876051178.png

 

AniketChavan_2-1755876253501.png

 

 

Scenario when I was not present inside the group:

AniketChavan_3-1755876298762.png

 

AniketChavan_4-1755876337020.png

 

 

 

 

Hope this helps. I’ll drop the KB link here as well for reference.

 

Sharing some additional reference link for this limitation : LINK

🔹 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

Hello @nageswari1 / @Nageshwari P 

 

Just wanted to check in to see if my earlier response helped you out or if you're still facing any issues. If your query is resolved, it would be great if you could mark my reply as helpful and accept it as the solution — that way it can also benefit others who come across the thread later.

 

Let me know if you need anything else!

 

Best regards,
Aniket Chavan
ServiceNow MVP 2025 | ServiceNow Rising Star 2024

Hello @nageswari1 / @Nageshwari P 

 

Just wanted to check in to see if my earlier response helped you out or if you're still facing any issues. If your query is resolved, it would be great if you could mark my reply as helpful and accept it as the solution — that way it can also benefit others who come across the thread later.

 

Let me know if you need anything else!

 

Best regards,
Aniket Chavan
ServiceNow MVP 2025 | ServiceNow Rising Star 2024