how to do variable editor read only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 11:28 PM
I have a requirement to make the variables under Variable Editor Read-Only once an INTAKE is generated (from a submission of a Service Catalog).
function onLoad() {
var template = g_form.getValue('u_template');
if (template != "28c64a0837f1cf00548b53b543990efd"){
var sections = g_form.getSections();
sections[2].style.display = 'none';
sections[2].style.display = 'none';
//To do variable editor read only
$(variable_map).select("item").each(function (elmt){
alert('hi');
try {
alert('qname453467568');
g_form.setDisabled('variables.' + elmt.getAttribute('qname'),true);
alert('qname');
} catch (err) {
}
});
//
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 11:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2017 11:41 PM
Hi Aakash, i have checked the link script and edited my code, but still it is not working please see my code if i m=need to change any thing here.
function onLoad() {
var template = g_form.getValue('u_template');
if (template != "28c64a0837f1cf00548b53b543990efd"){
var sections = g_form.getSections();
sections[2].style.display = 'none';
sections[2].style.display = 'none';
//To do variable editor read only
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
‎10-12-2017 12:01 AM
Hi,
The simplest way to do so in OOTB is to write a onLoad client script on Requested Item table with below line:
g_form.setVariablesReadOnly(true);
Please note that this does not work in Service Portal. If you also want to make this read only in service Portal, please let me know.
Else, service now will come with the support for it in Future Version as promised.
Regards,
Avinash
Please mark this as correct if it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2017 12:04 AM
Hi Avinash,
This is on Intake(ticket) table. Yes, i want to do om serviceportal also