Custom fields on multiple entities
Overview
Currently Custom Fields 'extend' one type of entity, possibly limited to one or more subtypes(*) of that entity.
Sometimes it would be useful to allow a set of Custom Fields to be linked to multiple entities.
[(*) - "subtypes" in a broad sense. In the case of Contacts, the fields can be linked to sub-types. For entities like Activities, fields can be linked to say Phone Calls and Meetings which are not strictly subtypes]
Example use-case
-
Suppose we want to create custom fields for 'service providers'. Some 'service providers' are Organizations (subtype SP-O), some are Individuals (subtype SP-I).
Current options are:
- link the fields to Contacts - but the fields are only relevant to small proportion of Contacts.
- duplicate the custom fields for each subtype - need to search multiple similar fields that logically should be one.
-
Suppose we want to create a field common to multiple entities (eg 'is_validated' on Memberships, Contributions & Participants). This would require separate field sets per entity.
Current behaviour
The current model comes from a single inheritance background: this set of fields 'extends' a particular entity.
Proposed behaviour
A more flexible model is to think of a set of fields 'attached' to a selection of entities. (Vaguely like PHP traits vs class inheritance.)
Comments
Looking for feedback on this in two main areas:
-
Is this desirable?
-
How practical is it? Custom fields are used very widely so figuring out a transition plan is key. If APIv4 can bridge the gap between the current situation and a new world then it becomes feasible. @colemanw - I know you've already done a load of work with APIv4 and Custom Fields and probably best placed to answer this bit.