AnsweredAssumed Answered

Trying to create a relationship between Opportunities and Meetings and use the existing subpanel

Question asked by Artis Plocins on Dec 11, 2017
Latest reply on Dec 12, 2017 by Artis Plocins

The goal is to create a one-to-many relationship of Opportunity to Meetings (opportunity_meetings_1).


As you know, Opportunities already have such a relationship (opportunity_meetings) because Meetings has a native flex-relate field.


I know that creating a new relate field in this case would add an additional Meetings subpanel to Opportunities. That makes reports and other things awkward and a lot less practical


I need to create this Opportunity relationship field in Meetings so that when an opportunity is specified there, it is added to the same Meetings subpanel in the oppportunity record.


My installdefs currently contain this code:

$installdefs = array(
  'id' => 'Opportunity_Meetings_Relationship',
  'vardefs' => array(
          'from' => '<basepath>/vardefs_meetings.php',
          'to_module' => 'Meetings'
  'relationships' => array(
        'meta_data' => '<basepath>/opportunity_meetings_1MetaData.php'

Where the vardefs_meetings.phpfile defines a relationship field:

$dictionary['Meeting']['fields']['opportunities'] = array(
    'name' => 'opportunity_meetings_1',
    'type' => 'link',
    'relationship' => 'opportunity_meetings_1',
    'source' => 'non-db',
    'module' => 'Opportunities',
    'bean_name' => 'Opportunity',
    'vname' => 'LBL_OPPORTUNITIES',
    'id_name' => 'opportunity_meetings_1_id',
    'link-type' => 'one',
    'side' => 'left',

And I originally added all the fields and indices and everything as per the Developer Guide, but now I'm just using adjusted values that I copied from the native opportunity_meetings relationship with hope that it would use the same relationship table or something and use the same Meetings subpanel in Opportunities rather than creating yet another Meetings subpanel:

$dictionary['opportunity_meetings_1'] = array(
    'name' => 'opportunity_meetings_1',
    'lhs_module' => 'Opportunities',
    'lhs_table' => 'opportunities',
    'lhs_key' => 'id',
    'rhs_module' => 'Meetings',
    'rhs_table' => 'meetings',
    'rhs_key' => 'parent_id',
    'relationship_type' => 'one-to-many',
    'relationship_role_column' => 'parent_type',
    'relationship_role_column_value' => 'Opportunities',

But, alas, no subpanel is created at all and I have no Opportunity relationship field that I could place on the layout for Meetings.