- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2015 10:12 AM
Hi ServiceNow Community Developers
I am trying to build an access control for variables in the requested item (sc_req_item) table. When I try this out I can see the oob fields but for variables all I see is 'variables' I cannot see the actual variable names that I would like to build acls around. Do you guys know how do I build an acl for each variable within the service catalogue. Please advise.
Thanks,
Johannes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2015 11:21 AM
SWEET that is easy there is a client script you can add that will lock do the variables down.. you can apply that script on both the Item and or task forms...
just wrap it in an if statement and only open it up if the user is the requested for and you are done!
http://www.servicenowguru.com/scripting/business-rules-scripting/variables-form-readonly/
obtw.. the beauty of locking down your variables this way is you apply one script to the TABLE and it gets all your variables for every item with no maintenance required.!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 05:09 AM
I think I found a better (= more standard) way to solve this problem. You need two things
a) a display business rule that collects all variables:
function onDisplay(current, g_scratchpad) {
//This function will be automatically called when this rule is processed.
var keys = [];
for(var key in current.variables) {
keys.push(key);
}
g_scratchpad.variable_names = keys;
}
b) a generic UI policy that hides these variables:
function onCondition() {
g_scratchpad.variable_names.forEach(function(v) {
var field_name = "variables." + v;
g_form.setReadOnly(field_name, true);
});
}
Make both of them apply to the Requested Item table, and optionally add some conditions to the UI policy to hide the variables only in certain cases. This solution does not depend on any custom DOM manipulation and is completely upgradable. It works for all Catalog Items and all variables and requires minimum maintenance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 08:15 PM
Hi Julian,
Thanks for the solution, but the script does not make the variables readonly in Service Portal. Is there any workaround?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2015 04:17 AM
Hi all, if someone could help with my CMS/variable/ACL query I would be very grateful:
We have an item 'Book a meeting' in our ESS portal.
A manager says she cannot offer the item until a better summary of what's being requested is presented to the user. Currently when the above item is requested a thank-you message appears with a one line summary (see thank-you screen shot attached).
When the user clicks on the link the summary page appears (screenshot attached).
Is there a way we can easily show the variables the user has completed here? Furthermore can we allow the ESS users to edit the variables?
Finally, if the above is possible can we limit this to certain items only e.g. for only on the 'Book a meeting' item show the variables and/or potentially allow users to edit the variables for this item (but not other items)?
Many thanks,
Daniel