Need to restrict/hide variable section from RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 07:21 AM - edited 12-27-2024 07:29 AM
Hi All,
We have a requirement in order to hide variable section from the RITM for all the users except members from the group 'abc' for the catalog item 'Support'.
Step 1: Need to check the cat_item field value is 'Support'
Step 2: check the current user who loads/opens the form is member of the group 'abc'
Step 3: If yes, then he should be able to see the variable section
Step 4: If no, then the variable section and the variable fields inside the variable section should not be visible
Please help me on this.
Thanks,
Joyal Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 07:36 AM
Hello @Joyal
This can be useful: Hide a variable in RITM
The above post shows how we can hide particular variable in ritm.
A bit of workaround can help you to meet your requirement.
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 07:41 AM
Hi @Juhi Poddar
Actually what i am looking here is that only members in the group should be able to see the Variable section apart from that any other shouldn't be able to view the variable section entirely
Thanks,
Joyal Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2024 07:40 AM
it should be an easy onLoad client script on sc_req_item table + Display BR on sc_req_item
Display BR:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.isMember = gs.getUser().isMemberOf('group ABC'); // give the group name here
})(current, previous);
onLoad client script
Ensure Isolate Script field is False to allow DOM to run the client script
This field is not on form but from list you can make it false
function onLoad(){
if(g_form.getValue('cat_item') == 'catItemSysId' && g_scratchpad.isMember.toString() == 'true'){
// use DOM manipulation to hide the section
}
}
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
12-27-2024 07:49 AM - edited 12-27-2024 08:46 AM
Hi @Ankur Bawiskar ,
I had written the below scripts:
script include:
Onload Client Script:
I was not able to get the expected result. Could you please help me on to fix the issue?
Thanks,
Joyal Robert