Categories:

Use GlideAjax in Service Portal in onSubmit Client Script

You are correct that you cannot use synchronous GlideAjax (getXMLWait()) in the Service Portal. 

Use the below code:

function onSubmit() {
	if (!g_form.ajaxComplete) {
		ajaxCall();
		return false;
	}
}

function ajaxCall() {
	var ga = new GlideAjax(script_include);
	ga.addParam("sysparm_name", function_name);
	ga.getXMLAnswer(function(a){
		// Do whatever you want to with the answer
		// Once you've handle the answer, run these two lines:
		g_form.ajaxComplete = true;
		g_form.submit();
	});
}

Total Views: 1297

2 Responses

  1. Great – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all the tabs and related information ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or anything, web site theme . a tones way for your customer to communicate. Excellent task.

  2. Whats Going down i’m new to this, I stumbled upon this I’ve found It absolutely useful and it has aided me out loads. I am hoping to contribute & help other customers like its aided me. Great job.

Leave a Reply

Your email address will not be published. Required fields are marked *