EntityRef custom fields don't work with API4 or SearchKit
Overview
EntityRef custom fields don't return values when selected in API4. Even after I fixed that, they're not part of the CRM.crmSearchAdmin.joins
so they're not selectable in SearchKit.
Reproduction steps
API4 issue:
- Create an EntityRef custom field.
- Go to API4 Explorer.
- Try to use them comparably to how one might use a core EntityRef field (e.g. Contact
employer_id
).
Selecting the field directly returns NULL
. You can't join on EntityRef.
I have a PR that fixes the above, but after that, the joins still don't appear in SK. I've tracked the issue down to \Civi\Search\Admin::getJoins()
but this exceeds my API4 knowledge limit.
Technically I'd consider this part of #3721 (closed) but since that's closed we'll track this separately.
@herbdool Once this is done, #3949 (closed) could be solved by using an EntityRef custom field instead of ContactRef.