Output printing as [object object] .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 05:50 AM
script include : i want 3 values and i am getting 3 logs , but in client script i am getting error , can someone please suggest
client script :
function mycallback(answer) {
answer = JSON.parse(response.responseXML.documentElement.getAttribute("answer"));
//answer = JSON.parse(result);
var adgroup = answer.var1;
var url = answer.var2;
var orgsuffix = answer.var3;
alert('two');
g_form.setValue('ad_groupp', adgroup);
g_form.setValue('U_URL', url);
g_form.setValue('org_suffix', orgsuffix);
alert("ad grp is " + adgroup);
alert("url is " + url);
alert("os is " + orgsuffix);
}
return false;
}
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2022 08:56 AM
but i have 6 variables to take in to consideration so cannot write onchange, any suggestions ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 08:16 AM
Hi,
ideally you should not set any fields/variables using onSubmit.
you can use onChange client script for this
If my response helped please mark it correct and close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 04:05 PM
Can't call AjaxXML() on onSubmit(). AjaxXML() is asynchronous and onSubmit() will continue executing before Script Include returns a value.
> i have 6 variables to take in to consideration so cannot write onchange
Just do a Save on the first variable onChange() and change the variable name and right click on the header area and select "Insert and Stay" on other 5 variables.
The other choice is to check with business rule instead of using client script.