Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 03:09 AM
Hi @Kentaro Numata ,
The Mistake With your Code is not returning the Short Description , through the Script
Client Script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('GetProblemRecord');
ga.addParam('sysparm_name', 'GetProblemRecord1');
ga.addParam('sysparm_sysID', newValue);
ga.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.addInfoMessage(answer);
});
}Script Includes:
var GetProblemRecord = Class.create();
GetProblemRecord.prototype = Object.extendsObject(AbstractAjaxProcessor, {
GetProblemRecord1: function() {
var inc = this.getParameter('sysparm_sysID');
var problemGr = new GlideRecord('problem');
problemGr.addQuery('sys_id', inc);
problemGr.query();
if (problemGr.next()) {
return problemGr.short_description.toString();
} else {
return "No matching problem record found";
}
},
type: 'GetProblemRecord'
});
Make Sure , you are Ticking the Client callable Field and It is Working Fine in my PDI
Please mark as Helpful and accept the Solution , if your issue is resolved
Thanks Regards
Badrinarayan