I'm putting this one in the undocumented feature category.
Here's the challenge: I wanted to create a relationship between Accounts and a custom module in modulebuilder. Modulebuilder allows the set up of relationships with existing modules as long as the custom module is the primary module (left hand side).
However, you can establish a relationship in modulebuilder where the custom module is the right hand side by following these simple steps:
1) Establish the relationship where the custom module is the primary.
2) Edit the relationships.php file in the packages module directory and reverse the roles (custom/modulebuilder/packages/<yourpackage>/module/<custom-module>/relationships.php).
3) Deploy the module as usual. The relationship will be created as if it were done in studio.
For example, with a custom module called Subscribers that has a many-to-one relationship with Accounts, establish the subscribers_accounts relationship in modulebuilder. This creates the following code in relationships.php:
Now, reverse the relationship to setup the correct relationship.Code:<?php $relationships = array ( 'subscribers_accounts' => array ( 'rhs_label' => 'Accounts', 'rhs_subpanel' => 'default', 'lhs_module' => 'Subscribers', 'rhs_module' => 'Accounts', 'relationship_type' => 'one-to-many', 'readonly' => false, 'deleted' => false, 'relationship_only' => false, 'for_activities' => false, 'is_custom' => false, 'relationship_name' => 'subscribers_accounts', ), ); ?>
Then deploy the module as usual through modulebuilder and the relationship will be created.Code:<?php $relationships = array ( 'accounts_subscribers' => array ( 'rhs_label' => 'Subscribers', 'rhs_subpanel' => 'default', 'lhs_module' => 'Accounts', 'rhs_module' => 'Subscribers', 'relationship_type' => 'one-to-many', 'readonly' => false, 'deleted' => false, 'relationship_only' => false, 'for_activities' => false, 'is_custom' => false, 'relationship_name' => 'accounts_subscribers', ), ); ?>


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks