Hi andy, that blog post you linked was my salvation when I had to do something similar a few months ago.
Even though you did an excellent job laying out everything in detail, I still found it difficult to apply to my case. Learning by example isnāt always enough, sometimes the logic being the example is needed.
Even though my code is working now, I still donāt fully understand it and would like to ask you if you could please explain this part a little better:
In the vardefs, we define three fields, e_date_cancelled, event_cancelled and cancelled_id. Itās the first one that is unclear to me:
$dictionary['Contact']['fields']['e_date_cancelled'] =
array (
'name' => 'e_date_cancelled',
'rname' => 'id',
'relationship_fields'=>array('id' => 'cancelled_id', 'date_cancelled' => 'event_cancelled'),
'type' => 'relate',
(....)
If I understand correctly, this is a sort of āvirtual fieldā, not stored in the database, is that right? Why is this needed?
Then those fields being mapped in relationship_fields? They seem to be mapping the stuff in the metadata for the relationship (āidā and ādate_cancelledā) to the stuff that comes next in these vardefs (a dictionary entry for ācancelled_idā and āevent_cancelledā). Again, why?
Finally, when we get to the subpanel definitions, it seems we need to include all three fields there (e_date_cancelled, event_cancelled and cancelled_id), but leave them as āquery_onlyā if we donāt intend to show them to the user, or else give them a label and a width and show them.
Can you help with some more insights? For me this is a basic need when data modelling, using fields in relationships⦠and it is still way too difficult to do in SuiteCRMā¦