Pass sys_id or Name for reference fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 06:47 AM - edited 12-13-2022 10:14 AM
I have written Before Insert Business rule on Incident form.
(function executeRule(current, previous /*null when async*/) { current.assignment_group = 'Analytics'; |
But once the incident is created, this is how it looks:
As seen above, 'Assingned to' is set to the right value from business rule, but why not for 'Assignment group'?
- If i pass the sys_id for assignment group, then it works
- but for Assigned to field, if I pass sys_id/user name/user ID.... still it works.
What is the issue?
Note - Display value is set to FALSE for ALL the fields for both User and Group table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:36 AM
Best practice -
Use sysId instead of name.
Why - there may be duplicate value for same text like in your case Assignment group name can be same for other group name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 08:33 AM
There is only 1 group with that name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 07:48 AM
Hi @Suggy ,
If you are updating a reference field, then you have to use the sys_id of the record.
In your case, you are hardcoding the values to the assignment group and assigned to field. Which might work in some cases and not all the time. If you are updating the assignment group and assigned to dynamically, then you have to use the sys_id of the record.
Out of curiosity - Did you refresh the record once the Assigned to field has been updated? Possible that it might be blank after refreshing.
Regards,
Gagan k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 08:35 AM
Thanks for replying, but that does not answer my question.
After refreshing, its the same.