How to create a relationship using module loader?

I get the error "Manifest file must specify the package type" when I use the following manifest.

$manifest = array (
0 =>
array (
'acceptable_sugar_versions' =>
array (
0 => '9.0.3',
),
),
1 =>
array (
'acceptable_sugar_flavors' =>
array (
0 => 'PRO',
),
),
'readme' => '',
'key' => 'JCCC',
'author' => 'JCCC',
'description' => '',
'icon' => '',
'is_uninstallable' => true,
'name' => 'Courses',
'published_date' => '2020-08-10',
'type' => 'module',
'version' => 1379709849,
'remove_tables' => 'prompt',
);

$installdefs = array(
'relationships' => array(


array(
'meta_data' => '<basepath>/SugarModules/relationships/relationships/accounts_contacts_1MetaData.php'
)
);

  • Custom relationships also require the TableDictionary to be defined, pointing to the MetaData file. If it's missing, it could cause unexpected behavior or simply not form the relationship. See this doc for more information on manually creating custom relationships. A Quick Repair and Rebuild is also necessary afterwards.

    Custom Relationships:
    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.0/Data_Framework/Relationships/Custom_Relationships/

  • https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.0/Architecture/Module_Loader/Introduction_to_the_Manifest/

    This shows only 

    $installdefs['relationships'][0]['meta_data'] = 
    '<basepath>/SugarModules/relationships/relationships/my_module_accountsMetaData.php';
  • The error is that it is not recognizing the Type of the package. I think your problem is at the beginning of your definition.

    Try this

    $manifest = array (
    'acceptable_sugar_versions' =>
    array (
    0 => '9.0.3',
    ),
    ),
    'acceptable_sugar_flavors' =>
    array (
    0 => 'PRO',
    ),
    ),
    'readme' => '',
    'key' => 'JCCC',
    'author' => 'JCCC',
    'description' => '',
    'icon' => '',
    'is_uninstallable' => true,
    'name' => 'Courses',
    'published_date' => '2020-08-10',
    'type' => 'module',
    'version' => 1379709849,
    'remove_tables' => 'prompt',
    );
  • Still getting the same response.

  • Looks like I missed some parentheses. Try this:

    $manifest = array (
    'acceptable_sugar_versions' =>
    array (
    0 => '9.0.3',
    ),
    'acceptable_sugar_flavors' =>
    array (
    0 => 'PRO',
    ),
    'readme' => '',
    'key' => 'JCCC',
    'author' => 'JCCC',
    'description' => '',
    'icon' => '',
    'is_uninstallable' => true,
    'name' => 'Courses',
    'published_date' => '2020-08-10',
    'type' => 'module',
    'version' => 1379709849,
    'remove_tables' => 'prompt',
    );
  • It looks like you fixed where the () are.  I figured that out after I was told that I forgot the <?php ?> tags.

  • Thank you for everyone's help.  I was missing the <?php tags.  The arrays in the manifest were off.  Also I had too many directories called relationships. Below is correct.

    <?php
    $manifest = array (
    0 => array (
    'acceptable_sugar_versions' => array (
    0 => '9.0.3',
    ),
    ),
    1 => array (
    'acceptable_sugar_flavors' => array (
    0 => 'PRO',
    ),
    ),
    'readme' => '',
    'key' => 'JCCC',
    'author' => 'JCCC',
    'description' => '',
    'icon' => '',
    'is_uninstallable' => true,
    'name' => 'Courses',
    'published_date' => '2020-08-10',
    'type' => 'module',
    'version' => 1379709849,
    'remove_tables' => 'prompt',
    );

    $installdefs = array(
    'relationships' => array(
    array(
    'meta_data' => '<basepath>/SugarModules/relationships/accounts_contacts_1MetaData.php'
    )
    )
    );
    ?>