HR Assignment Rules | Pull Record Producer Variables for Routing

wmouser
Tera Contributor

Hi there. My company is a multinational conglomerate that routes HR cases to 3 different regions, with various teams within each region.

 

We currently are using HR Assignment Rules to route cases to each region based on the subject person's location using the criteria builder. We have these triplicated as we have one rule to route to groups covering the Americas, one rule that routes to groups covering EMEA and one group covering AsiaPacific.

 

wmouser_0-1721165749749.png

I am needing to go one step further and do some scripting to route the case differently based on the record producer variables that are selected from the portal.

 

How do I gain access to the record producer variables from within the Assignment Rules script?

 

Our setup has the record producer dump variable outputs into the 'Description' field on the HR Cases. We have a requirement that if the selection made is 'Sales Compensation" it routes to Group A but if any other selection is made it routes to Group B.

 

When I try to write something like the following, it's not working

 

var rfc = producer.reason_for_change;
if (rfc == "Sales Compensation") {
    current.assignment_group='9a3e60971b39469092b51138bd4bcb2a';
} else {
    current.assignment_group='ec5a2c5f1bf5469092b51138bd4bcbf8';
}
 
I know that's in the syntax for the Record Producer script and not a for Assignment Rules, but that's what I'm struggling with. I also know the sys_id values for the groups isn't leading practice either.
 
How can I construct a script that pulls the variables from the record producer that created the case so I can help guide routing based on the selection made from the dropdown?
1 ACCEPTED SOLUTION

Mark Manders
Mega Patron

If it's in the description field, can't you just use 'description contains "selection is 'Sales Compensation'" or however it is set in the description? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

3 REPLIES 3

Mark Manders
Mega Patron

If it's in the description field, can't you just use 'description contains "selection is 'Sales Compensation'" or however it is set in the description? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Sandeep Rajput
Tera Patron
Tera Patron

@wmouser I am assuming the record producer is used to raise the HR Case. If this assumption is true then you can use the following script to route the case.

 

var rfc = current.variables.reason_for_change;
gs.info('RFC value '+rfc);
if (rfc == "Sales Compensation") {
    current.assignment_group='9a3e60971b39469092b51138bd4bcb2a';
} else {
    current.assignment_group='ec5a2c5f1bf5469092b51138bd4bcbf8';
}

 

If the script doesn't work, check the logs and see what value is printed in logs via gs.info on the second line of this code.

Hi Sandeep - the logic would need to be hard-coded for several scenarios if I set the script on the Record Producer itself. If we only had to choose between 2 groups it might work for us but we technically have 6 group options between the 2 groups (tier 1 / 2) and the 3 different regions so that script could become difficult to maintain.

 

Thank you for taking the time to offer your thoughts!