How to set the Assigned to field using a reference field on the HR Profile in an Assignment Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi everyone,
I'm working on a ServiceNow HRSD implementation and need some help with an Assignment Rule.
I'm using the table sn_hr_core_case_workforce_admin. The assignment group is already determined by assignment rule , and I need to populate the Assigned to field using a custom reference field on the HR Profile table (sn_hr_core_profile).
The HR case has a reference field called hr_profile, which points to the relevant HR Profile record.
I tried the following script in the Assignment Rule's Script field:
if (!current.getValue('hr_profile')) {
// No HR Profile available
} else {
var profile = current.hr_profile.getRefRecord();
if (profile.isValidRecord()) {
var payrollAgent = profile.getValue('reference field);
if (payrollAgent) {
current.setValue('assigned_to', payrollAgent);
}
}
}
owever, the script does not populate the Assigned to field as expected.
I also tested retrieving the payroll agent from the HR Profile in a Before Insert Business Rule, and that approach worked but the assignment group didn t populate and the state comes work in progress. However, I would prefer to achieve this using the Assignment Rule rather than creating a Business Rule.
