- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 06:33 AM
We have a Business Rule which locks down all RITMs so that the variables cannot be edited. We now have a requirement for a certain role to be able to unlock variables on a particular catalog item. Is anyone able to point me in the direction of a solution please?
The Business Rule runs on the sc_item_options table
When to run:
Before Update
Updated by is not system
Condition:
current.value.changes()&¤t.value != previous.value
Script:
gs.addInfoMessage('You are not allowed to change any information on this form once submitted.');
current.setAbortAction(true);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 06:46 AM
Not the right way though to disable variables.
However, with your current design you can do this.
if(!gs.hasRole('custom_role')//custom_role this is the role which will have access to variables
{
gs.addErrorMessage('You are not allowed');
current.setAbortAction(true);
}
However, have a look at the below for disabling vaiables
Check below for different ways to disable a variable, I personally like the client script one.
https://www.servicenowguru.com/scripting/business-rules-scripting/variables-form-readonly/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 06:46 AM
Not the right way though to disable variables.
However, with your current design you can do this.
if(!gs.hasRole('custom_role')//custom_role this is the role which will have access to variables
{
gs.addErrorMessage('You are not allowed');
current.setAbortAction(true);
}
However, have a look at the below for disabling vaiables
Check below for different ways to disable a variable, I personally like the client script one.
https://www.servicenowguru.com/scripting/business-rules-scripting/variables-form-readonly/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 07:05 AM
Hi,
You can try creating onload client script on catalog item :
function onLoad() {
if(g_user.hasRoleFromList("xyz") ){
g_form.setReadOnly('requested _for', false);
}