glide Ajax is not wokring in the Workspace client script in servicenow

sushma9
Tera Contributor

Hi All ,

 I am creating one Ui action in the workspace . Ui action is working fine in the native view but in the Workspace its not working .

Note : Alert is coming with the sys id the record in the workspace and after that its going inside the script include which we are using in the workspace . Same Script include is used in native view and its working fine.

Please find the code : Workspace 

 function onClick(g_form) {
     alert(g_form.getUniqueValue());
     var ga = new GlideAjax('dttl_Ajax_Poc');
     ga.addParam('sysparm_name', 'getpocprivacy');
     ga.addParam('sysparm_numb', g_form.getUniqueValue());
     ga.getXML(HelloWorldParse);

     function HelloWorldParse(response) {
         var answer = response.responseXML.documentElement.getAttribute("answer");
         alert(answer); 
     }
 }
 
Script include :

    getpocprivacy: function() { //Getting PA  Sys_id and Corresponding Required data

        var paSysId = this.getParameter("sysparm_numb"); // declaring the varibale which we are getting from the pa record
        gs.info("Demon" + "PA" + paSysId);
        var information = '';
        var grPA = new GlideRecord('incident'); //
        grPA.addQuery('sys_id', paSysId); // query the sys id with pa record sys id
        grPA.query();
        if (grPA.next()) {
information = grPA.number ;
        }
        return information;





    },
    type: 'dttl_Ajax_Poc'
4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Did you add the client script to the workspace client script field on the UI Action?

@Brad Tilton 

 

yes I have added and what ever the script i have updated in the question that is there in the workspace client script. 

Hi Sushma,

 

I'm encountering the same issue, the glide ajax is working fine in the script field but not the workspace client script fields. Did you solve the issue? Any suggestions?

 

Best

Estelle1
Tera Guru

In case anyone encounter this issue again. Seems like the workspace client script only support ga.getXMLAnswer() method. So if you cannot make this running, please try below code.

ga.getXMLAnswer(function(answer){

alert(answer);

});