How to Auto populate Assignment group when we select category and Sub-Category in catalog. I tried

Tulasiram1
Kilo Guru

How to Auto populate Assignment group when we select category and Sub-Category in catalog. I tried with catalog client script and script include but not populating.

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

//Type appropriate comment here, and begin script below
if(g_form.getValue('sub_category')==''){
return;

}
var Assignment_Group = new GlideAjax('getTitle');
getAssignment_Group.addParam('sysparm_name', 'getAssignment_Group');
getAssigment_Group.addParam('sysparm_user_id', newValue);
getAssignment_Group.getXML(setAssignment_Group);

function setTitle(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue(('job_Assignment_Group', answer));
}


}

 

script include :

var GetAssignment_Group = Class.create();
GetAssignment_Group.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignment_Group : function(){
var user_id = this.getParameter('sysparm_user_id');
var grUser = new GlideRecord('sys_user');
grUser.addQuery();
if(grUser.next()){
return grUser.getValue('Assignment_Group');
}
},
type: 'GetAssignment_Group'
});

 

 

 

 
 

 

 

7 REPLIES 7

Gopi Naik1
Kilo Sage

Hi @Tulasiram1 ,

 

In your client script you are calling a class 'getTitle' But your script include name is GetAssignment_Group. And you are trying to get assignment_group field value from user record, Do you have that field on user table?

Could you please elaborate your requirement what you are trying to achieve?

 

Thanks,

Gopi 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Mohan raj
Mega Sage

Hi @Tulasiram1 ,

In Client script, try to use alert function to debug. Check if you're getting response from the script include. 

Uday_Kumar
Giga Guru

Hello @Tulasiram1 How are you ?

Please elaborate your requirement clearly so that i can help you. There is no assignment group field in user table. please mention the fields that you are using to auto populate the assignment group. what is the dependent value .

 

Please mark it helpful if it help you

Thanks and regards 

Uday Kumar Valapudasu