Hi all, i want to display the values as pop up , on click of a button 'supp detail using ui action.

sanjeevgupt0181
Tera Contributor

can somebody help me with this problem ,
client script in ui action : 

// trying to fetch the orderlineitem value from the form : 

var orderlineitem = current.order_line_item.toString();
var ga = new GetSuppDetailUtil().getDetail(orderlineitem);
ga.getXMLAnswer(function(response) {
var answer  = response.responseXML.documentElement.getAttribute("answer");
var result = JSON.parse(answer);
result.forEach(function(record) {
           html += "<tr><td>" + result.hotcut + "</td><td>" + result.reasontype + "</td></tr>"+"<tr><td>" + result.reasoncode + "</td><td>" ;
       });
   var modal = new GlideModal("Related Records");
       modal.setBody(html, false, false);
       modal.render();
});

script include :
var GetSuppDetailUtil = Class.create();
GetSuppDetailUtil.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

    getDetail: function(Orditem) {

        var result = {
            hotcut: "",
            reasontype: "",
            reasoncode: "",
        };
        var gr = new GlideRecord('u_service_order_enrichment');
        gr.addEncodedQuery("u_order_line_item=" + Orditem);
        gr.query();
        if (gr.next()) {
            result.hotcut = gr.getDisplayValue('u_hotcut');
            result.reasontype = gr.getDisplayValue('u_reason_type');
            result.reasoncode = gr.getDisplayValue('u_reason_code');
            gs.info("result_hotcut" + result.hotcut);
        }
        gs.info("all_result" + result);
        return JSON.stringify(result);
    },
    type: 'GetSuppDetailUtil'
});


when trying to display the data as pop up onclick of button "supp details " in the form , the values are not populating from the response of the script include can somebody help me with this code ! 


0 REPLIES 0