- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2009 06:04 AM
Because in this case we couldn't change the default display value for all only because of the service catalog, I did the following workaround:
- create a new catalog variable, read only
- create the following catalog client script
SCRIPT
On change Location variable:
function onChange(control, oldValue, newValue, isLoading) {
if (!newValue || newValue == '') { //If the source is empty
g_form.setDisplay('location_display', false); //Do not display the name (hide)
return; //Stop
}
var source = newValue; //Get the sys id of the source
var gr = new GlideRecord('cmn_location'); //Table of the source
gr.get(source); //Get the single record
g_form.setValue('location_display',gr.full_name); // Display the full name instead of the display value
g_form.setReadonly('location_display',true); // Set the field read only, even for admin
g_form.setDisplay('location_display', true); // Display the field with the full name already filled in
}