ensure custom field checkboxes are populated in profiles #17562
Closed
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
Ensure that custom fields that use the checkbox html type are populated when viewing an existing record, i.e. when using the "Update multiple contacts" search action.
Replicate
Before
When you run "Update Multiple Contacts" on a profile with a custom checkbox field, the existing values are not shown. All contacts show no checkboxes checked even if their contact record shows that they have checkboxes checked.
After
Now, checkboxes are properly checked.
Technical Details
The checkbox field is an outlier when it comes to handling default data. Select, Multi-select, radio and other fields with one or more values will work fine with one entry in the $defaults array that is set to an array of values to populate.
But the checkbox needs each individual checkbox that should be checked to be an entry in the $defaults array.
Comments
Maybe it would be better to fix the form layer so that checkboxes could accept default values in the same format as all the other fields??
Also @colemanw - this code was very recently touched by you - so I hope I'm not clobbering some other functionality that you fixed in d4502c2.