Populating the Employee field on HR Case

satya30
Tera Contributor

HI, I have a quick question on mapping variables from Intake form to case

On the record producer - created and employee field which matches the exactly the same field on HR case.

tried to populate the employee field on the form with client scripts record producer scripts also applies on target record record but on the target record the value is getting populated from proposed position details not from current.

I don't see any scripts configured for this and how is it getting mapped?

Please help me with the request.

satya30_1-1769981070505.png

 


I tried taking out all field values.

if you see classification, employee passed probation, bilingual designation position came from the intake form value not knowing how is the employee field being set.

Before My enhancements - the value selected in particular field are shown up in proposed position details employee name came from that but after the enhancement value selected in same field should be shown in current position details and did the same but why the employee field value is changed and is populating from position details itself.

To modify i tried checking all the scripts but there is nothing available.

Please help.


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.