Set Variables readonly on RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2021 07:35 PM
Hi Community
I need help for the below requirement
I want to make the variables read-only on the RITM form. I wrote a UI policy on the RITM table please find it below
This is working, but I have some variables for which the "Name" starts with "Edit_" should be editble on the RITM.
I have tried the below code, but it is not working
g_form.setReadOnly('variables.nameLIKEEdit^active=true','false');
Can you please help me if there is a way to fix this
Thanks in advance
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2021 01:57 AM
Hi,
so you are using the above normal client script.
Then you can use display business rule and update your script as this
Please use display BR on sc_req_item table
g_scratchpad.isMember = gs.getUser().isMemberOf('Group ABC');
client script
function onLoad() {
if(g_scratchpad.isMember.toString() == 'false'){
$("variable_map").querySelectorAll("item").forEach(function(item){
var variable = item.getAttribute("qname");
if(!variable.startsWith('edit')){
// if not starts with edit then make those readonly
g_form.setReadOnly("variables."+ variable, true);
}
});
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2021 11:28 PM
Hi Sandeep,
You can achieve this requirement through configuration only.
1. In UI policy set condition if Name is not Edit
2. Write UI action to set the field read only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2021 11:39 PM
Hi Changej khan
I have tried for the 1st point what you have mentioned.
But whatever the UI policy I wrote on sc_req_item table I was not able to select Variable.name on the condition of the UI policy