how to make read only variables on requested item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2017 09:51 AM
currently iam using the below script for making read only of available all variables on my requested item but now i want writable few of variables depends upon some conditon .how can i proceed this scenario can you please explain.
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_user.hasRole("itil"))
{
try{
//Get the 'Variables' section
var ve = $('variable_map').up('table');
//Disable all elements within with a class of 'cat_item_option'
ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
elmt.disabled = true;
});
//Remove any reference or calendar icons
ve.select('img[src*=reference_list.gifx]', 'img[src*=small_calendar.gifx]').each(function(img){
img.hide();
});
//Hide list collector icons
ve.select('img[src*=arrow]').each(function(img){
img.up('table').hide();
});
}
catch(e){}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2017 10:09 AM
Will this thread help? All Variables Readonly Client Script - add roles and editable fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2017 10:15 AM
Hi Rakesh,
Have a catalog client script which applies to RITM view and as per your condition add following line of code
First make all fields readonly using below code and then add your condition to make few of the fields as non-readonly
g_form.setVariablesReadOnly(true);
if(condition is true){
// make fields you want as non-readonly one by one
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
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
07-03-2017 10:32 AM
If condition is true how to make it writable can you please help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2017 10:36 AM
Actually my requirement is I have to create new field qualification true/false the variable form if the qualification is true the variable is editable on requested item...otherwise read only
Kindly suggest how to achieve this