When I use "GlideAjax", is a record kept in a table somewhere?

bonsai
Mega Sage

If I use "GlideAjax" with the following code, will a log be saved in a table?

 

// client script – contains onLoad function and a callback function

function onLoad() {
   var ga = new GlideAjax('GetUserInfo'); // GetUserInfo is the script include name 
   ga.addParam('sysparm_name','managerName'); // managerName is the function in the script include that we're calling 
   ga.addParam('sysparm_user_name','fred.luddy'); // set user to Fred Luddy 

   /* Call GetUserInfo.managerName() with user set to Fred Luddy and use the callback function ManagerParse() to return the result when ready */
   ga.getXMLAnswer(ManagerParse);  		
}

// callback function for returning the result from the script include
function ManagerParse(response) {  
   alert(response);
}


// GetUserInfo script include 

var GetUserInfo = Class.create();
GetUserInfo.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

    managerName: function() {
        var userName = this.getParameter("sysparm_user_name");
        var grUser = new GlideRecord('sys_user');
        grUser.get("user_name", userName);

        // Build the payload. You can return additional data if needed. 
        var result = {    
           "manager": grUser.getDisplayValue('manager')
        }; 
        return JSON.stringify(result);
    },
    type: 'GetUserInfo'
});

I would like to check the parameters when executing the following script include:

 

ga.addParam('sysparm_name','managerName');
ga.addParam('sysparm_user_name','fred.luddy');

 

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@bonsai 

what's your exact question?

GlideAjax and REST are 2 different things

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

This will not be stored in any table. You can log these in your script include with ex -  

 

var sysparmName = this.getParameter('sysparm_name');

var sysparmUserName = this.getParameter('sysparm_user_name');

gs.info('sysparm_name: ' + sysparmName);

gs.info('sysparm_user_name: ' + sysparmUserName);

View solution in original post

5 REPLIES 5

bonsai
Mega Sage

Is the mechanism of "GlideAjax" similar to REST?
If so, will it be recorded in a REST-related table?

This will not be stored in any table. You can log these in your script include with ex -  

 

var sysparmName = this.getParameter('sysparm_name');

var sysparmUserName = this.getParameter('sysparm_user_name');

gs.info('sysparm_name: ' + sysparmName);

gs.info('sysparm_user_name: ' + sysparmUserName);

Ankur Bawiskar
Tera Patron

@bonsai 

what's your exact question?

GlideAjax and REST are 2 different things

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Runjay Patel
Giga Sage

Hi @bonsai ,

 

Check below thread for understanding the glideAjax in details.

Like whats the purpose of it, how you can call, how you can return multi variables and so on..

https://servicenowwithrunjay.com/glideajax-in-servicenow/

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Here in this Video, I have covered the Basic of ITOM and CMDB as well as Introduction about the ITOM Module. Thank you for visiting my channel. Here, I'll share various technical knowledge. Feel free to reach out to me directly for any Service Now-related queries. Your support encourages me to ...