Populate RITM assignment group in a catalog variable using glideajax and script include

Kamal Jangid
Tera Contributor

When we order a catalog item there is an assignment group showed in RITM. How to populate that assignment group value in catalog item variable(field) using glideajax and script include.

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Kamal Jangid 

you want to populate field on RITM or variable on catalog item?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

i want to populate field which is present on Ritm only but is a field of catalog item like shown in image.ritm.png

Harish Bainsla
Kilo Patron
Kilo Patron


// MyScriptInclude.js

var MyScriptInclude = Class.create();
MyScriptInclude.prototype = {
initialize: function () { },

getAssignmentGroup: function (ritmSysID) {
var assignmentGroup = '';
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(ritmSysID)) {
assignmentGroup = ritmGR.assignment_group.getDisplayValue();
}
return assignmentGroup;
},

type: 'MyScriptInclude'
};

// Client Script

function populateAssignmentGroupValue() {
var ritmSysID = g_form.getValue('request_item');

var ga = new GlideAjax('MyScriptInclude');
ga.addParam('sysparm_name', 'getAssignmentGroup');
ga.addParam('sysparm_ritmSysID', ritmSysID);
ga.getXML(populateAssignmentGroupCallback);
}

function populateAssignmentGroupCallback(response) {
if (response && response.responseXML) {
var answer = response.responseXML.documentElement.getAttribute('answer');
if (answer) {
g_form.setValue('assignment_group_variable', answer);
}
}
}

S Goutham
Tera Guru

Hey @Kamal Jangid :

 

What are you trying to achieve here The RITM will be routed to the appropriate fulfillment group when the request is submitted This is either achieved via an Assignment rule or on Workflow or flow designer

 

If are expecting to show which group request needs to be routed then you need to have a reference qualifier advanced or simple on the group table reference field on the catalog field.

 

I hope this solves your issue
Mark this as Helpful / Accept the Solution if this clears your issue