- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2024 11:36 PM
Client Script onload method
Ajax class method (of course I have extended global.AbstractAjaxProcessor)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 06:38 PM - edited 04-21-2024 06:40 PM
Hi @zhanglixin ,
Please pass strings as the parameters to the Ajax class, update your code as shown below:
function onLoad() {
var inRecordLog = {};
inRecordLog.screen_name_report_name = "Screen Name Report Name";
inRecordLog.manipulate_content = "loading";
var gAjax = new GlideAjax("ajaxUtil");
gAjax.addParam("sysparm_name","recordLogClient");
gAjax.addParam("sysparm_inRecordLog", JSON.stringify(inRecordLog));
gAjax.addParam("sysparm_inOnclickFlag", "false");
gAjax.getXMLAnswer(function(response){
});
}
Please check this article for explanation: https://www.servicenow.com/community/developer-forum/how-do-i-pass-an-array-to-glideajax/m-p/2141792
In your Ajax class, use JSON.parse to convert string to JSON object after you get the value of the parameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 01:31 PM
Hi @zhanglixin,
Do you get anything from the log?
Or are the parameters the only bits that are missing from the log?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 06:38 PM - edited 04-21-2024 06:40 PM
Hi @zhanglixin ,
Please pass strings as the parameters to the Ajax class, update your code as shown below:
function onLoad() {
var inRecordLog = {};
inRecordLog.screen_name_report_name = "Screen Name Report Name";
inRecordLog.manipulate_content = "loading";
var gAjax = new GlideAjax("ajaxUtil");
gAjax.addParam("sysparm_name","recordLogClient");
gAjax.addParam("sysparm_inRecordLog", JSON.stringify(inRecordLog));
gAjax.addParam("sysparm_inOnclickFlag", "false");
gAjax.getXMLAnswer(function(response){
});
}
Please check this article for explanation: https://www.servicenow.com/community/developer-forum/how-do-i-pass-an-array-to-glideajax/m-p/2141792
In your Ajax class, use JSON.parse to convert string to JSON object after you get the value of the parameter.