1.In change Form - Based on the Service selected , Assigned group has to be poppulate

nameisnani
Mega Sage

Hi Team , 


we have requirement that , In change request ,  Based on the Service selected , that Service Support group has to be populate in the Assignment group .

 

See in the Below screenshot , Service is Firewall NonProd and the Support Group is TCS-Network-SUP >> And the Same support group has to be populate in the assignment group .

 

 

How to fulfill this requirment , can any one please provide script for this , Please provide screenshot for better understanding .

 

Please provide test cases screenshot 

nameisnani_0-1727938619586.png

 

 

8 REPLIES 8

@Eshwar Reddy 

 

Could you please provide me the complete configuration steps  

Eshwar Reddy
Kilo Sage

@nameisnani 

Sure 
Create On change Client script on Service Field 
// Only proceed if the new value is not empty
if (newValue) {
var ga = new GlideAjax('SupportGroupUtil');
ga.addParam('sysparm_name', 'getSupportGroup');
ga.addParam('sysparm_service_sys_id', newValue); 

ga.getXMLAnswer(handelResponse);

function handelResponse(answer)
{
var supportGroupSysId =answer;

// Set the assignment group field (change 'assignment_group' to your actual field name)
g_form.setValue('assignment_group', supportGroupSysId);
}
}

script include 

getSupportGroup: function() {
var supportGroup = ''; // Default value if not found
var serviceSysId = this.getParameter('sysparm_service_sys_id'); // Get the service sys_id passed from the client script

if (serviceSysId) {

var serviceGr = new GlideRecord('your_service_table'); // Replace with your actual service table name
if (serviceGr.get(serviceSysId)) {

supportGroup = serviceGr.support_group.sys_id.toString(); // Adjust the field name as necessary
}
}

 

Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution

return supportGroup;
},

 




@Eshwar Reddy 

 

There is an error 

 

nameisnani_0-1727946827728.png

 

@nameisnani 
Create a script include with this name "SupportGroupUtil" dont give any spaces