- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks 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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Okay, then I would try setting both values from the script side alone. I have seen similar "bugs" when trying to combine script with "no code" options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
Are you doing the assignment group and assigned to in same assignment rule? If no, you should try that. Only one rule fires - so if one matches it won't trigger another one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Yes i m doing both in same assignment rule.
in the assign to tab i filled the group and in the script part i added a script to populate the assign to from the subject person field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Okay, then I would try setting both values from the script side alone. I have seen similar "bugs" when trying to combine script with "no code" options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you so much it worked that way when i put both assignment group and the assigned to in one script