- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi,
I am trying to set a variable in the catalog item to read only for other than Service Desk group at the sc_req_item level. I tried it but still non Service Desk group is able to edit it. Kindly help.
(function executeRule(current, previous /*null when async*/ ) {
if(gs.getUser().isMemberOf('Service Desk'))
{
g_scratchpad.variable = true;
}
})(current, previous);
function onLoad() {
if(g_scratchpad.variable!=true){
g_form.setReadOnly('features', true);
}
}
Regards
Suman P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Ankur Bawiskar,
I am definitely not as good as you, but I can guarantee we can use g_scratchpad for catalog item. The only change i made is checking the checkbox in the catalog client script.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Ankur Bawiskar,
I am definitely not as good as you, but I can guarantee we can use g_scratchpad for catalog item. The only change i made is checking the checkbox in the catalog client script.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Sorry my bad.
It does work.
Infact you missed that "Applies on Requested Item" checkbox
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
g_scratchpad could not be used in catalog client script.
You will require normal onLoad client script instead of catalog client script
BR Script Updated
(function executeRule(current, previous /*null when async*/ ) {
g_scratchpad.variable = gs.getUser().isMemberOf('Service Desk');
})(current, previous);
onLoad normal client script
function onLoad() {
if (g_scratchpad.variable.toString() != 'true') {
g_form.setReadOnly('features', 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
4 hours ago
@ServiceNow Use6 - Please use onLoad client script with GlideAjax for your requirement. As you cannot use g_scratchpad in the catalog client script on the catalog form.
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @ServiceNow Use6 ,
If you want Service Desk agents to be the only ones who can update after submission, use Variable Editor UI Policy. If you want to truly secure it (so even GlideRecord update scripts etc. can’t change it), store it as a field on sc_req_item and secure via ACLs.