Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Populating the Employee field on HR Case

satya30
Tera Contributor
 
1 ACCEPTED SOLUTION

SupriyaWaghmode
Kilo Sage

Hello @satya30  , 

 

In HRSD, variable mapping often happens "behind the scenes" through standard Record Producer logic or specialized HR Script Includes. Based on your description, the issue is likely due to one of the following hidden mapping mechanisms: 

  1. Automatic Field Matching (Name Sync) 

ServiceNow automatically maps Record Producer variables to HR Case fields if their Internal Names match exactly. 

  • The Issue: If your variable name matches an OOB field like employee, ServiceNow will try to map it directly, bypassing your scripts.
  • The Fix: Check if the variable's name field is identical to the target field name on the sn_hr_core_case table. If you want to control this via script, change the variable name so it is unique (e.g., v_employee_name). 
  1. OOB HR Script Include (hr_CaseUtils) 

Standard HR Record Producers often use a script call like new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id); in the Script field. 

  • The Issue: This script calls hr_CaseUtils.populateCase(), which is designed to grab data from the Record Producer and populate the Case. It often pulls from the "Subject Person" or "Employee" context linked to the HR Service configuration.
  • The Fix: Review the HR Service [sn_hr_core_service] record associated with this Record Producer. Check the Case Creation Service Configuration to see if specific fields are being "auto-filled" from the user profile. 
  1. HR Case Template

The HR Service is likely linked to an HR Template [sys_template]

  • The Issue: Templates can hard-code or dynamic-map values during record creation. If your template has a value for the "Employee" field, it may be overwriting your Record Producer script values.
  • The Fix: Open the HR Service and check the Template field. Ensure the template isn't setting the employee field from a "Proposed" position or profile source. 

Troubleshooting Steps

  1. Check Variable Name: Ensure your variable name does not match the field name exactly if you want to avoid automatic mapping.
    Please mark accepted solution if this resolves your query.
    Thanks & Regards ,

    Supriya Waghmode |ServiceNow Consultant

View solution in original post

2 REPLIES 2

SupriyaWaghmode
Kilo Sage

Hello @satya30  , 

 

In HRSD, variable mapping often happens "behind the scenes" through standard Record Producer logic or specialized HR Script Includes. Based on your description, the issue is likely due to one of the following hidden mapping mechanisms: 

  1. Automatic Field Matching (Name Sync) 

ServiceNow automatically maps Record Producer variables to HR Case fields if their Internal Names match exactly. 

  • The Issue: If your variable name matches an OOB field like employee, ServiceNow will try to map it directly, bypassing your scripts.
  • The Fix: Check if the variable's name field is identical to the target field name on the sn_hr_core_case table. If you want to control this via script, change the variable name so it is unique (e.g., v_employee_name). 
  1. OOB HR Script Include (hr_CaseUtils) 

Standard HR Record Producers often use a script call like new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id); in the Script field. 

  • The Issue: This script calls hr_CaseUtils.populateCase(), which is designed to grab data from the Record Producer and populate the Case. It often pulls from the "Subject Person" or "Employee" context linked to the HR Service configuration.
  • The Fix: Review the HR Service [sn_hr_core_service] record associated with this Record Producer. Check the Case Creation Service Configuration to see if specific fields are being "auto-filled" from the user profile. 
  1. HR Case Template

The HR Service is likely linked to an HR Template [sys_template]

  • The Issue: Templates can hard-code or dynamic-map values during record creation. If your template has a value for the "Employee" field, it may be overwriting your Record Producer script values.
  • The Fix: Open the HR Service and check the Template field. Ensure the template isn't setting the employee field from a "Proposed" position or profile source. 

Troubleshooting Steps

  1. Check Variable Name: Ensure your variable name does not match the field name exactly if you want to avoid automatic mapping.
    Please mark accepted solution if this resolves your query.
    Thanks & Regards ,

    Supriya Waghmode |ServiceNow Consultant

Sabrina Ethridg
ServiceNow Employee

Do any of the variable names or field names on the Case form match field names on HR Profile?  I have found that sometimes this causes problems as well.