Assignment lookup is not working in universal request but working in incident form.

Pravinkishore M
Tera Contributor

Issue with the assignment group update based on Category and sub category. Only one value is not working in universal request but it is working in incident. not sure what is the issue here.

 

Example : Category - ABC , Subcategory - BCD - > Assignment group - Alphabets.

But the assignment group is empty when selecting the category and sub category.

3 REPLIES 3

Rafael Batistot
Kilo Patron

Hi @Pravinkishore M 

 

May you consider to use a onChange client script via gladeAjax to get the assignment group 

 

the logic is when you select the subcategory the assignment filled automatically, so you can use it anytime and anywhere 

 

See an example: 

 

OnChange 

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

var category = g_form.getValue('category');
var subcategory = g_form.getValue('subcategory');

// Only proceed if both fields have values
if (!category || !subcategory) {
return;
}

// Call server-side logic to find assignment group
var ga = new GlideAjax('URAssignmentLookup'); // Script Include name
ga.addParam('sysparm_name', 'getAssignmentGroup');
ga.addParam('sysparm_category', category);
ga.addParam('sysparm_subcategory', subcategory);
ga.getXMLAnswer(function(response) {
if (response) {
g_form.setValue('assignment_group', response);
} else {
g_form.clearValue('assignment_group');
}
});
}

 

Include script

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

getAssignmentGroup: function() {
var category = this.getParameter('sysparm_category');
var subcategory = this.getParameter('sysparm_subcategory');

// Change 'u_assignment_mapping' to your mapping table name
var gr = new GlideRecord('u_assignment_mapping');
gr.addQuery('category', category);
gr.addQuery('subcategory', subcategory);
gr.query();

if (gr.next()) {
return gr.assignment_group.toString();
}
return '';
}

});

Hi Rafael,

 

We have other values which is working as expected , only one of them is not working. 
The same configuration is made for all in assignment lookup .

Rushi Savarkar
Kilo Sage

Hello @Pravinkishore M 

 

If other assignment groups are working with the same configurations, then this should work.

 

1. Please check the value of the nonworking category and subcategory.

2. Also, verify if there is any space in the Label or Value. 

3. Check for Assignment Group sys_id

If my response helped you, please accept the solution and mark it as helpful.
Thank You!