Badrinarayan
Kilo Sage

Hi @Kentaro Numata , 

The Mistake With your Code is not returning the Short Description ,  through the Script 

Client Script

Screenshot 2024-10-04 at 3.34.44 PM.png

 

 

 

 

 

 

 

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:

Screenshot 2024-10-04 at 3.37.45 PM.png

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