- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 04:50 AM
I tried populating location field using g_form.getReference() it worked. but I am not able to achieve it using GlideAjax. Kindly help.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 06:08 AM
Did this work for you? Still any questions? Could you please update. I do see you are posting other questions again. So please resond to the topics your posting and where people are responding to.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 04:56 AM
Hi there,
See this article I wrote a few weeks ago. Contains detailed explanation and examples:
Client Side Scripting: Go for GlideAjax (with getXMLAnswer)!
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2020 05:02 AM
Hi,
Can you share the GlideAjax code that you have written. I can check and correct it for you.
Refer to this link for sample script include.
Mark the comment as helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 06:46 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga=new GlideAjax('AutopopulatedetailsC');
ga.addParam('sysparm_name',setEmail);
ga.addParam('sysparm_caller',g_form.getValue('caller_id'));
ga.getXML(getResponse);
function getResponse(response)
{
var answer=response.responseXML.documentElement.getAttribute('answer');
//return answer;
//var answer=response;
g_form.setValue('email',answer);
}
//Type appropriate comment here, and begin script below
}
ScriptInclude:
var AutopopulatedetailsC = Class.create();
AutopopulatedetailsC.prototype = Object.extendsObject(AbstractAjaxProcessor, {
setEmail:function(){
var gr=new GlideRecord('sys_user');
gr.addQuery('sys_id',this.getParameter('sysparm_caller'));
gr.query();
if(gr.next())
{
return gr.email;
}
},
type: 'AutopopulatedetailsC'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2020 12:09 AM
Okay 2 changes.
In SI, replace this line
return gr.email
with
return gr.getValue("email");
In the client script, replace this line
ga.addParam('sysparm_caller',g_form.getValue('caller_id'));
with
ga.addParam('sysparm_caller',newValue);
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP