To get Value of LOOKUP SELECT BOX field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 01:57 AM
I have created a variable set 'facility' and inside that a variable named 'building'.. Variable building is of type LOOKUP SELECT box.. i want to map the value in field building to description field in RITM...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 03:54 AM
Look up value field will only return a single field information. If you would like to populate description field with both name and location then you need to use GlideAjax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 03:55 AM
Could you help me with GlideAjax code

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 04:22 AM
Here are the scripts
Update the look up value field back to sys_id and try the below scripts
You might need to the formating while setting in the description field
Client script
var ga = new GlideAjax('GetBuildingInfo');
ga.addParam('sysparm_name','getInfo');
ga.addParam('sysparm_Building_id', g_form.getValue('building'));
ga.getXML(builInfo);
function builInfo(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('description', JSON.stringify(answer));
}
Script Include
Name:GetBuildingInfo
Client callable: true
var GetBuildingInfo = Class.create();
GetBuildingInfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getInfo: function() {
var dat = this.getParameter('sysparm_Building_id');
var gr = new GlideRecord("YOUR_TABLE_NAME");
gr.addQuery("sys_id", "IN", dat);
gr.query();
var arr=[];
while (gr.next()) {
var obj = {};
obj.name = gr.name.toString();
obj.location = gr.location.getDisplayValue();
arr.push(obj);
}
return new JSON().encode(arr);
},
type: 'GetBuildingInfo'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 09:38 AM
tried this.. but not working 😞

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2019 10:12 AM
Is the table name updated in script include?
Also, can you put an alert statement in client script and see what value is it returning for JSON.stringify(answer)