A reference field shows the correct display name, but the actual record is not the intended/expected record when examined or clicked through.
This happens as a result of the following combined conditions:
- The reference field was set using setDisplayValue
- There are multiple records on the referenced target table which match the value
An example of this may be when there are multiple [sys_user] records for the same person or the same name, and a reference field like [caller_id] implements some custom logic that uses g_form or current's setDisplayValue (ex: John Smith). If there are 2 John Smith users, the reference field's auto-completer will look up the name and return the first result it finds.
To resolve the behavior, we recommend to always use 'setValue' for reference fields and pass in the precise 'sys_id' for the expected record.