Relate
From SugarCRM Wiki
A SugarField that can hold a value from another bean in the same or another module.
Contents |
Attributes
Universal Attributes
Unique Attributes
Display Parameters
| Attribute | Description | Views | Compatibility | Required |
| class | The HTML class attribute of the text input field | EditView, SearchView | 5.x | No, defaults to "sqsEnabled" |
| size | The HTML size attribute of the text input field | EditView, SearchView | 5.x | No |
| readOnly | The HTML readonly attribute of the text input field | EditView, SearchView | 5.x | No, defaults to <empty>, can be "readonly" or "disabled" |
| useIdSearch | ??? | SearchView | ??? | ??? |
| hideButtons | Hide "Select" and "Clear" buttons after the form field | EditView, SearchView | 5.x | No, defaults to false |
| popupData | The JavaScript used to create the selection popup | EditView, SearchView | 5.x | No |
| selectOnly | Hide "Select" and "Clear" buttons after the form field | EditView, SearchView | 5.x | No, defaults to false |
| allowNewValue | ??? | EditView, SearchView | 5.x | No, defaults to true |
| call_back_function | Part of popupData | EditView, SearchView | 5.x | set_return |
| formName | Part of popupData | EditView, SearchView | 5.x | search_form |
| field_to_name_array | Part of popupData. Defines what fields need to be transferred to the current bean when a user clicks on a related bean in the popup. | EditView, SearchView | 5.x | search_form |
Inherited Vardef Attributes
| Vardefs | Smarty Attribute | Description | Compatibility | Required |
| id_name | memberName | Required for link in DetailView and as a hidden form field in EditView and SearchView | 5.x | Required for link in DetailView |
| module | n/a | The module used in the link | 5.x | Required for link in DetailView |
| help | n/a | The help text for this field | 5.x | No |
| len | n/a | Length of the field | 5.x | No |
Interesting Notes
- Works with an accompanying Relate vardefs field.
- Uses a `special case` to prevent links to be created for the Users and Teams modules. You could also do this to other modules using Views to set the Smarty attribute 'nolink' to true:
$this->ss->assign('nolink', true);
- Has a `special case` for Accounts to copy address fields
Example
array(
'name' => 'inv_invoices_inv_invoicelines_name',
'displayParams' => array(
'field_to_name_array' => array(
'id' => 'inv_invoicev_invoices_ida',
'name' => 'inv_invoices_inv_invoicelines_name',
'account_id' => 'account_id',
'account_name' => 'account_name',
),
),
),
For an excellent tutorial on this, refer to this Lone Wolves article
Compatibility
5.x
