failed to find link for {link_name} custom relationship?

I have build a custom relationship manually and once I install the package I see the error on sugarcrm.log, do you know why, I have follow the documentation, is there anything that I need to do ?

Parents
  • Can you share the custom metadata you added into extended vardefs and relationship as well?

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi  , I know it's been a long time but, did you solve this issue? As of my upgrade to v12 I am getting a similar error in my log and a subpanel  has disappeared as a result.

    Thank you,

    FrancescaS

  • Hi  . This error pretty much is due to wrong relationship defined inside the field def for the link.

    Can you share the vardefs having such defintions as well as the relationship metadata?

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thank you  

    This is code that we've been dragging with us since we started using sugar in 2011, so it's very likely that something got left behind that is no longer acceptable...

    Tue Oct 15 15:39:20 2024 [19175][1][FATAL] failed to find link for role_contacroles_contacts

    custom/Extension/modules/Contacts/Ext/Vardefs/role_contact_roles_contacts_Contacts.php

    <?php
    // created: 2011-06-05 20:15:42
    $dictionary["Contact"]["fields"]["role_contacroles_contacts"] = array (
      'name' => 'role_contacroles_contacts',
      'type' => 'link',
      'relationship' => 'role_contact_roles_contacts',
      'source' => 'non-db',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
    );

    custom/Extension/modules/Contacts/Ext/Layoutdefs/role_contact_roles_contacts_Contacts.php

    <?php
    // created: 2011-06-05 20:15:42
    $layout_defs["Contacts"]["subpanel_setup"]["role_contacroles_contacts"] = array (
      'order' => 100,
      'module' => 'role_Contact_Roles',
      'subpanel_name' => 'default',
      'sort_order' => 'asc',
      'sort_by' => 'id',
      'title_key' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'get_subpanel_data' => 'role_contacroles_contacts',
      'top_buttons' =>
      array (
        0 =>
        array (
          'widget_class' => 'SubPanelTopButtonQuickCreate',
          //'widget_class' => 'SubPanelTopCreateButton',
        ),
    //    1 => 
    //    array (
    //      'widget_class' => 'SubPanelTopSelectButton',
    //      'mode' => 'MultiSelect',
    //    ),
        1 =>
        array (
          'widget_class' => 'SubPanelTopFilterInputButton',
        ),
      ),
    );
    ?>

    custom/Extension/modules/Contacts/Ext/clients/base/layouts/subpanels/role_contact_roles_contacts_Contacts.php

    <?php
    $viewdefs['Contacts']['base']['layout']['subpanels']['components'][] = array (
      'label' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'context' =>
      array (
        'link' => 'role_contacroles_contacts',
      ),
      'layout' => 'subpanel',
    );
    $viewdefs['Contacts']['base']['layout']['subpanels']['components'][] = array (
      'override_subpanel_list_view' =>
      array (
        'view' => 'subpanel-for-contacts',
        'link' => 'role_contacroles_contacts',
      ),
    );
    

    custom/Extension/modules/role_Contact_Roles/Ext/Vardefs/role_contact_roles_contacts_role_Contact_Roles.php

    <?php
    $dictionary['role_Contact_Roles']['fields']['role_contacroles_contacts']['name'] = 'role_contacroles_contacts';
    $dictionary['role_Contact_Roles']['fields']['role_contacroles_contacts']['type'] = 'link';
    $dictionary['role_Contact_Roles']['fields']['role_contacroles_contacts']['relationship'] = 'role_contact_roles_contacts';
    $dictionary['role_Contact_Roles']['fields']['role_contacroles_contacts']['source'] = 'non-db';
    $dictionary['role_Contact_Roles']['fields']['role_contacroles_contacts']['vname'] = 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['name'] = 'role_contac_contacts_name';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['type'] = 'relate';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['source'] = 'non-db';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['vname'] = 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['save'] = true;
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['id_name'] = 'role_conta552dontacts_ida';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['link'] = 'role_contacroles_contacts';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['table'] = 'contacts';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['module'] = 'Contacts';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['rname'] = 'name';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['db_concat_fields'][0] = 'first_name';
    $dictionary['role_Contact_Roles']['fields']['role_contac_contacts_name']['db_concat_fields'][1] = 'last_name';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['name'] = 'role_conta552dontacts_ida';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['type'] = 'id';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['relationship'] = 'role_contact_roles_contacts';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['source'] = 'non-db';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['reportable'] = false;
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['side'] = 'right';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['vname'] = 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['link'] = 'role_contacroles_contacts';
    $dictionary['role_Contact_Roles']['fields']['role_conta552dontacts_ida']['rname'] = 'id';
    

  • Thank you Francesca. I don't see the relationship metadata itself.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • It should be defined inside custom/metadata/. The name of the file may follow the relationship name itself.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thank you! I never messed with that directory before :)

    custom/metadata/role_contact_roles_contactsMetaData.php

    <?php
    $dictionary['role_contact_roles_contacts'] = array (
      'true_relationship_type' => 'one-to-many',
      'relationships' =>
      array (
        'role_contact_roles_contacts' =>
        array (
          'lhs_module' => 'Contacts',
          'lhs_table' => 'contacts',
          'lhs_key' => 'id',
          'rhs_module' => 'role_Contact_Roles',
          'rhs_table' => 'role_contact_roles',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'role_contacles_contacts_c',
          'join_key_lhs' => 'role_conta552dontacts_ida',
          'join_key_rhs' => 'role_conta48dct_roles_idb',
        ),
      ),
      'table' => 'role_contacles_contacts_c',
      'fields' =>
      array (
        'id' =>
        array (
          'name' => 'id',
          'type' => 'varchar',
          'len' => 36,
        ),
        'date_modified' =>
        array (
          'name' => 'date_modified',
          'type' => 'datetime',
        ),
        'deleted' =>
        array (
          'name' => 'deleted',
          'type' => 'bool',
          'len' => '1',
          'default' => '0',
          'required' => true,
        ),
        'role_conta552dontacts_ida' =>
        array (
          'name' => 'role_conta552dontacts_ida',
          'type' => 'varchar',
          'len' => 36,
        ),
        'role_conta48dct_roles_idb' =>
        array (
          'name' => 'role_conta48dct_roles_idb',
          'type' => 'varchar',
          'len' => 36,
        ),
      ),
      'indices' =>
      array (
        0 =>
        array (
          'name' => 'role_contacroles_contactsspk',
          'type' => 'primary',
          'fields' =>
          array (
            0 => 'id',
          ),
        ),
        1 =>
        array (
          'name' => 'role_contacroles_contacts_ida1',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'role_conta552dontacts_ida',
          ),
        ),
        2 =>
        array (
          'name' => 'role_contacroles_contacts_alt',
          'type' => 'alternate_key',
          'fields' =>
          array (
            0 => 'role_conta48dct_roles_idb',
          ),
        ),
      ),
    );
    

  • Thank you  . Find an updated code for your relationship

    $dictionary["Contact"]["fields"]["role_contacroles_contacts"] = array (
      'name' => 'role_contacroles_contacts',
      'type' => 'link',
      'relationship' => 'role_contact_roles_contacts',
      'source' => 'non-db',
      'module' => 'role_Contact_Roles',
      'bean_name' => 'role_Contact_Roles',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link-type' => 'many',
      'side' => 'left',
    
    );
    
    $dictionary["role_Contact_Roles"]["fields"]["role_contacroles_contacts"] = array (
      'name' => 'role_contacroles_contacts',
      'type' => 'link',
      'relationship' => 'role_contact_roles_contacts',
      'source' => 'non-db',
      'module' => 'Contacts',
      'bean_name' => 'Contact',
      'side' => 'right',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link-type' => 'one',
    );
    $dictionary["role_Contact_Roles"]["fields"]["role_contac_contacts_name"] = array (
      'name' => 'role_contac_contacts_name',
      'type' => 'relate',
      'source' => 'non-db',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE',
      'save' => true,
      'id_name' => 'role_conta552dontacts_ida',
      'link' => 'role_contacroles_contacts',
      'table' => 'contacts',
      'module' => 'Contacts',
      'rname' => 'name',
      'db_concat_fields' => array (
        'first_name', 'last_name'
      ),
    );
    $dictionary["role_Contact_Roles"]["fields"]["role_conta552dontacts_ida"] = array (
      'name' => 'role_conta552dontacts_ida',
      'type' => 'id',
      'source' => 'non-db',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link' => 'contacts',
      'table' => 'contacts',
      'module' => 'Contacts',
      'rname' => 'id',
      'reportable' => false,
      'side' => 'right',
      'massupdate' => false,
      'duplicate_merge' => 'disabled',
      'hideacl' => true,
    );
    
    $dictionary['role_contact_roles_contacts'] = array (
      'true_relationship_type' => 'one-to-many',
      'relationships' =>
      array (
        'role_contact_roles_contacts' =>
        array (
          'lhs_module' => 'Contacts',
          'lhs_table' => 'contacts',
          'lhs_key' => 'id',
          'rhs_module' => 'role_Contact_Roles',
          'rhs_table' => 'role_contact_roles',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'role_contacles_contacts_c',
          'join_key_lhs' => 'role_conta552dontacts_ida',
          'join_key_rhs' => 'role_conta48dct_roles_idb',
        ),
      ),
      'table' => 'role_contacles_contacts_c',
      'fields' =>
      array (
        'id' =>
        array (
          'name' => 'id',
          'type' => 'varchar',
          'len' => 36,
        ),
        'date_modified' =>
        array (
          'name' => 'date_modified',
          'type' => 'datetime',
        ),
        'deleted' =>
        array (
          'name' => 'deleted',
          'type' => 'bool',
          'len' => '1',
          'default' => '0',
          'required' => true,
        ),
        'role_conta552dontacts_ida' =>
        array (
          'name' => 'role_conta552dontacts_ida',
          'type' => 'varchar',
          'len' => 36,
        ),
        'role_conta48dct_roles_idb' =>
        array (
          'name' => 'role_conta48dct_roles_idb',
          'type' => 'varchar',
          'len' => 36,
        ),
      ),
      'indices' =>
      array (
        0 =>
        array (
          'name' => 'role_contacroles_contactsspk',
          'type' => 'primary',
          'fields' =>
          array (
            0 => 'id',
          ),
        ),
        1 =>
        array (
          'name' => 'role_contacroles_contacts_ida',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'role_conta552dontacts_ida',
            1 => 'deleted',
          ),
        ),
        2 =>
        array (
          'name' => 'role_contacroles_contacts_idb',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'role_conta48dct_roles_idb',
            1 => 'deleted',
          ),
        ),
        3 =>
        array (
          'name' => 'role_contacroles_contacts_alt',
          'type' => 'alternate_key',
          'fields' =>
          array (
            0 => 'role_conta48dct_roles_idb',
          ),
        ),
      ),
    );
    

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Thank you  . Find an updated code for your relationship

    $dictionary["Contact"]["fields"]["role_contacroles_contacts"] = array (
      'name' => 'role_contacroles_contacts',
      'type' => 'link',
      'relationship' => 'role_contact_roles_contacts',
      'source' => 'non-db',
      'module' => 'role_Contact_Roles',
      'bean_name' => 'role_Contact_Roles',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link-type' => 'many',
      'side' => 'left',
    
    );
    
    $dictionary["role_Contact_Roles"]["fields"]["role_contacroles_contacts"] = array (
      'name' => 'role_contacroles_contacts',
      'type' => 'link',
      'relationship' => 'role_contact_roles_contacts',
      'source' => 'non-db',
      'module' => 'Contacts',
      'bean_name' => 'Contact',
      'side' => 'right',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link-type' => 'one',
    );
    $dictionary["role_Contact_Roles"]["fields"]["role_contac_contacts_name"] = array (
      'name' => 'role_contac_contacts_name',
      'type' => 'relate',
      'source' => 'non-db',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_CONTACTS_TITLE',
      'save' => true,
      'id_name' => 'role_conta552dontacts_ida',
      'link' => 'role_contacroles_contacts',
      'table' => 'contacts',
      'module' => 'Contacts',
      'rname' => 'name',
      'db_concat_fields' => array (
        'first_name', 'last_name'
      ),
    );
    $dictionary["role_Contact_Roles"]["fields"]["role_conta552dontacts_ida"] = array (
      'name' => 'role_conta552dontacts_ida',
      'type' => 'id',
      'source' => 'non-db',
      'vname' => 'LBL_ROLE_CONTACT_ROLES_CONTACTS_FROM_ROLE_CONTACT_ROLES_TITLE',
      'id_name' => 'role_conta552dontacts_ida',
      'link' => 'contacts',
      'table' => 'contacts',
      'module' => 'Contacts',
      'rname' => 'id',
      'reportable' => false,
      'side' => 'right',
      'massupdate' => false,
      'duplicate_merge' => 'disabled',
      'hideacl' => true,
    );
    
    $dictionary['role_contact_roles_contacts'] = array (
      'true_relationship_type' => 'one-to-many',
      'relationships' =>
      array (
        'role_contact_roles_contacts' =>
        array (
          'lhs_module' => 'Contacts',
          'lhs_table' => 'contacts',
          'lhs_key' => 'id',
          'rhs_module' => 'role_Contact_Roles',
          'rhs_table' => 'role_contact_roles',
          'rhs_key' => 'id',
          'relationship_type' => 'many-to-many',
          'join_table' => 'role_contacles_contacts_c',
          'join_key_lhs' => 'role_conta552dontacts_ida',
          'join_key_rhs' => 'role_conta48dct_roles_idb',
        ),
      ),
      'table' => 'role_contacles_contacts_c',
      'fields' =>
      array (
        'id' =>
        array (
          'name' => 'id',
          'type' => 'varchar',
          'len' => 36,
        ),
        'date_modified' =>
        array (
          'name' => 'date_modified',
          'type' => 'datetime',
        ),
        'deleted' =>
        array (
          'name' => 'deleted',
          'type' => 'bool',
          'len' => '1',
          'default' => '0',
          'required' => true,
        ),
        'role_conta552dontacts_ida' =>
        array (
          'name' => 'role_conta552dontacts_ida',
          'type' => 'varchar',
          'len' => 36,
        ),
        'role_conta48dct_roles_idb' =>
        array (
          'name' => 'role_conta48dct_roles_idb',
          'type' => 'varchar',
          'len' => 36,
        ),
      ),
      'indices' =>
      array (
        0 =>
        array (
          'name' => 'role_contacroles_contactsspk',
          'type' => 'primary',
          'fields' =>
          array (
            0 => 'id',
          ),
        ),
        1 =>
        array (
          'name' => 'role_contacroles_contacts_ida',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'role_conta552dontacts_ida',
            1 => 'deleted',
          ),
        ),
        2 =>
        array (
          'name' => 'role_contacroles_contacts_idb',
          'type' => 'index',
          'fields' =>
          array (
            0 => 'role_conta48dct_roles_idb',
            1 => 'deleted',
          ),
        ),
        3 =>
        array (
          'name' => 'role_contacroles_contacts_alt',
          'type' => 'alternate_key',
          'fields' =>
          array (
            0 => 'role_conta48dct_roles_idb',
          ),
        ),
      ),
    );
    

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
No Data