APIv4 - Fix Activity contact virtual fields to work across joins #26374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This fixes an oversight that slipped by the review process in #25744
Before
The new virtual fields for
Activity.source/target/assignee_contact_id
worked well when they were attached to the main entity but not when part of a join.After
Fixed to work in any part of the query. Test updated.
Technical Details
Setting the column name to
id
means thesqlRenderer
callback function will receive the correct alias for that field depending on which part of the query it is used in (it's not alwaysa.id
).While I was in there I updated the test and consolidated the two tests in that file which were basically testing the same functionality.
I was also able to get rid of the "formatOutputForMultipleActivityContactIds" helper function because the API can automatically explode comma-separated values when serialization method is declared for the field.
FYI @highfalutin