Not getting the answer from Script Include in onSubmit Catalog Client Script by using GlideAjax

Ankit Balapure
Tera Contributor

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: 

AnkitBalapure_1-1747054808480.png

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

    checkAuthorization : function(){

		var userId = this.getParameter('sysparm_user_id');

		
		return "userId";

	},


    type: 'UserAuthorizationToFormSubmission'
});

 

 

Client Script:

AnkitBalapure_2-1747054926454.png

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: 

AnkitBalapure_0-1747054736188.png

 

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

Akiladevi Raje1
Giga Guru
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
AkiladeviRaje1_0-1747130421180.png