Re: How can I reproduce the Assigned to field functionality
the following example is from the custom module that I built from module builder, it should work in the same way for current working modules except the all the modifications should be overridden at the custom subdirectory...
1) add attributes to vardefs.php:
'account_manager_id' =>
array (
'name' => 'account_manager_id',
'rname' => 'user_name',
'id_name' => 'account_manager_id',
'vname' => 'LBL_ACCOUNT_MANAGER',
'type' => 'assigned_user_name',
'table' => 'users',
'isnull' => 'false',
'group'=>'account_manager_name',
'dbType' => 'id',
'reportable'=>true,
'comment' => 'account manager record'
),
'account_manager_name' =>
array (
'name' => 'account_manager_name',
'vname' => 'LBL_ACCOUNT_MANAGER_NAME',
'type' => 'relate',
'reportable'=>false,
'source'=>'non-db',
'rname'=>'user_name',
'table' => 'users',
'id_name' => 'account_manager_id',
'module'=>'Users',
'link'=>'account_manager_link',
'duplicate_merge'=>'disabled'
),
'account_manager_link' =>
array (
'name' => 'account_manager_link',
'type' => 'link',
'relationship' => 'account_manager_user',
'vname' => 'LBL_ACCOUNT_MANAGER_USER',
'link_type' => 'one',
'module'=>'Users',
'bean_name'=>'User',
'source'=>'non-db',
'duplicate_merge'=>'enabled',
'rname' => 'user_name',
'id_name' => 'account_manager_id',
'table' => 'users',
),
'relationships'=>array (
'accounts_manager_user' =>
array('lhs_module'=> 'Users', 'lhs_table'=> 'users', 'lhs_key' => 'id',
'rhs_module'=> 'IC_GiftCardPartners', 'rhs_table'=> 'ic_giftcardpartners', 'rhs_key' => 'account_manager_id',
'relationship_type'=>'one-to-many'),
)
2) in the detailviewdefs.php I added following to the panel section:
1 =>
array (
'name' => 'account_manager_name',
'label' => 'LBL_ACCOUNT_MANAGER',
), //don't forget to add LBL_ACCOUNT_MANAGER to the language file...
3) same step above but in the editviewdefs.php
John Zhang
[Server: WinXP]
[Sugar v5.0.0 GA]
[Apache 2.2.5]
[MySQL 5.0.45]
Bookmarks