XMLhttp.do 404 (Not Found) - Catalog Client Script

hanaphouse
Giga Guru

What's causing this error?
find_real_file.png

Catalog Client Script:

function onChange(control, oldValue, newValue, isLoading) {
	
	if (isLoading || newValue == ''){
		return;
	}
	
	var user = g_form.getReference('list_of_users',autoFill);
	
	function autoFill(user){
		g_form.setValue('job_title', user.title);
		g_form.setValue('email', user.email);
		g_form.setValue('phone_number_extension_no', user.home_phone);
		g_form.setValue('office',user.department);
	}
	
	var getDept = new GlideAjax('getDepartmentName');
	getDept.addParam('sysparm_name','getDepartment');
	//console.log("user department: " + user.department);
	getDept.addParam('sysparm_id',g_form.getValue('office'));
	getDept.getXML(DepartmentParser);
	
	function DepartmentParser(response){
		var answer = response.responseXML.documentElement.getAttribute("answer");
		g_form.setValue('office',answer);
	}
}

 

Script Include:

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

	getDepartment: function(){
		var name = '';
		var id = this.getParameter('sysparm_id');
		var dept = new GlideRecord('cmn_department');
		dept.addQuery('sys_id',id);
		dept.query();
		
		if(dept.next()){
			name = dept.name;
		}
		
		return name;
	},
	
	type: 'GetDepartmentName'
});
1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

Your GlideAjax in client script uses getDepartmentName while Script include uses GetDepartmentName.

View solution in original post

3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

Your GlideAjax in client script uses getDepartmentName while Script include uses GetDepartmentName.

Hahaha.. You are a life saver. You've got good eyesight. I think I need glasses now.

It was you who provided proper update as 404 brought it to attention directly there is something missing that system is not able to locate.

Remember always 404 - Is Not found & Script include is invoked only from line where you use GlideAjax. Since the name is different it says 404 which is not found & thus was quite simple.