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 Reply Children
  • 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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?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',
    );
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?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',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    <?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',
    ),
    );
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?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';
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Sorry   where would that be defined?

  • 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

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?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' =>
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Thank you  . Find an updated code for your relationship

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    $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',
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    André Lopes
    Lampada Global
    Skype: andre.lampada