Assignment rule script

Vamshi_ch123
Tera Contributor

Hi

There's a record producer variable  what's the nature of inquiry which is select box type based on the selection of the values assignment group should auto populate in hr cases.

 

There a value called documents upload in what is the nature of inquiry value by selection of that value employee details field will appear where need to select the user after selecting and submitted the form.

 

There are 2 hr cases will create with same hr service and description but different short description

 

My issue is that user selected hr cases assignment group is not populating.

 

May I know how to resolve the issue.

 

Thanks in advance. Attached the screenshot.

 

Hr cases are HRC1253312 AND HRC1253313

2 REPLIES 2

Abbas_5
Tera Sage
Tera Sage

Hello @Vamshi_ch123,

 

To automatically populate the assignment group in HR cases based on a select box variable in a record producer, you can use a script in the record producer's script fieldThis script will check the selected value in the "Nature of Inquiry" select box and then set the assignment_group field on the HR case accordingly. 
 
Here's a breakdown of how to do it:
 
  1. 1. Define the Record Producer:
    Create a record producer that maps to the HR Case table (or the relevant table where HR cases are created).
  2. 2. Create the Select Box Variable:
    Within the record producer, add a select box variable named "Nature of Inquiry". Populate this variable with the different types of inquiries you want to map to different assignment groups.
  3. 3. Add a Script to the Record Producer:
    • Go to the record producer's script field.
    • Use a script like this to dynamically set the assignment_group: 
       
  var natureOfInquiry = producer.nature_of_inquiry; // Get the selected value  // Example mapping (replace with your actual groups and values)  if (natureOfInquiry == 'Salary Issues') {      current.assignment_group = 'your_salary_issues_group_sys_id';  } else if (natureOfInquiry == 'Benefits Enrollment') {      current.assignment_group = 'your_benefits_enrollment_group_sys_id';  } else {      current.assignment_group = 'default_hr_group_sys_id'; // Default group if no match  }
  • Explanation:
     
    • natureOfInquiry gets the selected value from your "Nature of Inquiry" select box.
       
    • The if statements check the value and set the assignment_group to the appropriate group's sys_idReplace your_salary_issues_group_sys_idyour_benefits_enrollment_group_sys_id, and default_hr_group_sys_id with the actual sys_id values of your assignment groups. 
       
    • The else the statement provides a default assignment group in case no other condition is met.
       
  1. Test and Deploy: Save the record producer and test it to ensure the assignment group is being populated correctly based on the selected inquiry type. Deploy the record producer to your users.

If it is helpful, please hit the thumbs up icon and accept this solution; referring to this solution will be helpful to them.

 

Thanks & Regards,

Abbas Shaik

Bhavesh Bijagar
Tera Guru

Hi @Vamshi_ch123 

If you're using HR Assignment Rules, there's no longer a need to write custom scripts to access record producer variables. Instead, you can now use the Condition Builder to achieve the same functionality. Here's how to configure it:

  1. Enable Related Fields

    • In the condition builder, click "Show Related Fields" to access deeper field relationships.
  2. Access Record Producer Variables via "Questions"

    • Under the "Questions" section:
      • Select Item: Click the search icon and choose the relevant Record Producer.
      • Select Variable: Click the search icon again to pick the specific variable you want to use.
      • Select the operator
      • Select Value: Choose the value that should trigger the assignment rule.
  3. Use Logical Operators

    • Use the AND operator to combine multiple conditions if needed.
  4. Add HR Service Condition

    • Add a condition for HR Service to ensure the rule applies to the correct service.
  5. Save the Rule

    • Click Save to activate the assignment logic.

 

BhaveshBijagar_0-1748884368582.png