Not getting the answer from Script Include in onSubmit Catalog Client Script by using GlideAjax
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 06:09 AM
Hi,
Can anyone tell me that where am I going wrong. I am getting the null answer. Please refer the below scripts and screenshots.
Script Include:
var UserAuthorizationToFormSubmission = Class.create();
UserAuthorizationToFormSubmission.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkAuthorization : function(){
var userId = this.getParameter('sysparm_user_id');
return "userId";
},
type: 'UserAuthorizationToFormSubmission'
});
Client Script:
function onSubmit() {
var current_user = g_user.userID;
var auth_stat = new GlideAjax('UserAuthorizationToFormSubmission');
auth_stat.addParam('sysparm_user_id', current_user);
auth_stat.addParam('sysparm_name', 'checkAuthorization');
auth_stat.getXMLWait();
alert(auth_stat.getAnswer());
}
Output:
Please suggest why this is happening if I am trying to get the value from the script include which is client callable and called from the above mentioned client script by using the 'getXMLWait()' method.
Thanks,
Ankit
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 02:53 AM - edited 05-13-2025 03:00 AM
var UserAuthorizationToFormSubmission = Class.create();
UserAuthorizationToFormSubmission.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkAuthorization: function() {
var userId = this.getParameter('sysparm_user_id');
return userId;
},
type: 'UserAuthorizationToFormSubmission'
});
or else use autopopulate option