Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Record Producer Group Routing Enhancement

purdue
Kilo Sage

Hello,

We have a requirement to add RP assignment group lookup through a system property when the user selects release = HyperCare EMEA.  Currently the group assignment is routing is going through the code below.  I need to skip these if HyperCare is selected.  I need to pass in the application name into rp and return the group from system property.  For example if user selects application WBD SAP Fixed Assets/IO: Production then return group ESS WBD S4 Deloitte Hypercare FA/IO to rp assignment group if not then use the gliderecord below.

 

var supp_grp = new GlideRecord('u_support_group_routing');
supp_grp.addQuery('u_active', true);
supp_grp.addQuery('u_configuration_item', producer.select_application);
supp_grp.addQuery('u_record_producer', 'CONTAINS', cat_item.sys_id);
supp_grp.query();
if (supp_grp.next()) {
if (supp_grp.getValue('u_support_group')) {
supp_grpid = supp_grp.getValue('u_support_group');
}
}
current.assignment_group = supp_grpid;
 
Any assistance is appreciated.
Thanks,
Chad
1 ACCEPTED SOLUTION

Hello,

 

Working with our other developers we were able to come up a solution.   Here is the final solution in case someone has the same requirement.

Record Producer

var jsonData = JSON.parse(gs.getProperty("producer.sap_s4_support.groups")); //name of your property

if(!gs.nil(jsonData[release])){
group_name = jsonData[release][app];
}

if (!group_name)
{
var supp_grpid = gs.getProperty('incident.default.group'); //Global Service Desk
var supp_grp = new GlideRecord('u_support_group_routing');
supp_grp.addQuery('u_active', true);
supp_grp.addQuery('u_configuration_item', producer.select_application);
supp_grp.addQuery('u_record_producer', 'CONTAINS', cat_item.sys_id);
supp_grp.query();
if (supp_grp.next()) {
if (supp_grp.getValue('u_support_group')) {
supp_grpid = supp_grp.getValue('u_support_group');
}
}
current.assignment_group = supp_grpid;
}else{
current.assignment_group = group_name;
}
System Property
application id : group
{
"Hypercare EMEA": {
"a672baab933a82941243b47d1dba10c6": "773d18ba833a0e54cd1478226daad342 ",
"523376e3937a82941243b47d1dba1056": "9adcd87ec3b20a108dc3f8aa050131b8",
"34e376af937a82941243b47d1dba101d": "f2ae5cba93ba4a54c270b1266aba1065",
"488d5facc34346109a6a1ce0e00131e9": "f2ae5cba93ba4a54c270b1266aba1065",
"e5bdf43e33728254296947434d5c7b8d": "c6d0986e933a0654c270b1266aba108c",
"ead4b6ab93ba82941243b47d1dba10b3": "c6d0986e933a0654c270b1266aba108c",
"fcc5bae793fa82941243b47d1dba1006": "a21f94bac3f20a108dc3f8aa05013118",
"137dfcba33728254296947434d5c7bb3": "01ffd0ba333ec61497b552e36d5c7b83",
"e5e6d69393be0a5472ebf8a56aba108b": "bea2e87a93be06541243b47d1dba1013",
"ebf63667933e82941243b47d1dba104a": "e26f1cfac3f20a108dc3f8aa050131eb",
"ce487ea3937e82941243b47d1dba1086": "e26f1cfac3f20a108dc3f8aa050131eb",
"900620ea930e7910860bb6a74dba10c7": "f2bbe9ba833a8e54cd1478226daad392",
"d052fba58347c650cd1478226daad3f8": "f8c3d9301b98b1d0783f43b1b24bcbb8"
}
}

View solution in original post

8 REPLIES 8

Hi @purdue,

 

I hope my understanding is correct. Please try the following:

  1. Create a property and store the sys_ids of the 12 applications (comma separated: SYS_ID1,SYS_ID2 ...) 
  2. Create / Adjust your routing property as follow:

 

/*{
	"APPLICATION_SYS_ID_1" : "GROUP_SYS_ID1",
	"APPLICATION_SYS_ID_2" : "GROUP_SYS_ID2",
	"APPLICATION_SYS_ID_3" : "GROUP_SYS_ID3"
};*/​

 

  • Adjust the script on your record producer as follow:
    (Please check the variable, table and property names and your the value of "HyperCare EMEA" not the displayvalue)

 

//Get the list of 12 apps stored in property created in Step 1
var applications = gs.getProperty("APPLICATIONS_PROPERTY").toString().split(","); 

//Get the Routing property in Step 2
var applicationRouting = JSON.parse(gs.getProperty("APPLICATION_WRITTING_PROPERY"));

var arrayUtil = new global.ArrayUtil();
if(producer.release == "HyperCare EMEA" && arrayUtil.contains(applications, producer.select_application)){
	//Set assignment group
	current.assignment_group = applicationRouting[producer.select_application + ""];
}
else{
	//Do your existing GlideRecord operation
}​

 

I hope it helps!


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Hello,

 

Thanks for this.  How do I skip the gliderecord query if HyperCare EMEA?   I tried putting if producer.release != "Hypercare EMEA"  to skip gliderecord but still goes to glide. 

Thanks again.

Chad

Hi @purdue 

Could you please share screenshot from the release variable? Type and available choices.


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Hello,

 

Working with our other developers we were able to come up a solution.   Here is the final solution in case someone has the same requirement.

Record Producer

var jsonData = JSON.parse(gs.getProperty("producer.sap_s4_support.groups")); //name of your property

if(!gs.nil(jsonData[release])){
group_name = jsonData[release][app];
}

if (!group_name)
{
var supp_grpid = gs.getProperty('incident.default.group'); //Global Service Desk
var supp_grp = new GlideRecord('u_support_group_routing');
supp_grp.addQuery('u_active', true);
supp_grp.addQuery('u_configuration_item', producer.select_application);
supp_grp.addQuery('u_record_producer', 'CONTAINS', cat_item.sys_id);
supp_grp.query();
if (supp_grp.next()) {
if (supp_grp.getValue('u_support_group')) {
supp_grpid = supp_grp.getValue('u_support_group');
}
}
current.assignment_group = supp_grpid;
}else{
current.assignment_group = group_name;
}
System Property
application id : group
{
"Hypercare EMEA": {
"a672baab933a82941243b47d1dba10c6": "773d18ba833a0e54cd1478226daad342 ",
"523376e3937a82941243b47d1dba1056": "9adcd87ec3b20a108dc3f8aa050131b8",
"34e376af937a82941243b47d1dba101d": "f2ae5cba93ba4a54c270b1266aba1065",
"488d5facc34346109a6a1ce0e00131e9": "f2ae5cba93ba4a54c270b1266aba1065",
"e5bdf43e33728254296947434d5c7b8d": "c6d0986e933a0654c270b1266aba108c",
"ead4b6ab93ba82941243b47d1dba10b3": "c6d0986e933a0654c270b1266aba108c",
"fcc5bae793fa82941243b47d1dba1006": "a21f94bac3f20a108dc3f8aa05013118",
"137dfcba33728254296947434d5c7bb3": "01ffd0ba333ec61497b552e36d5c7b83",
"e5e6d69393be0a5472ebf8a56aba108b": "bea2e87a93be06541243b47d1dba1013",
"ebf63667933e82941243b47d1dba104a": "e26f1cfac3f20a108dc3f8aa050131eb",
"ce487ea3937e82941243b47d1dba1086": "e26f1cfac3f20a108dc3f8aa050131eb",
"900620ea930e7910860bb6a74dba10c7": "f2bbe9ba833a8e54cd1478226daad392",
"d052fba58347c650cd1478226daad3f8": "f8c3d9301b98b1d0783f43b1b24bcbb8"
}
}