The vardefs are used to provide the Sugar application with information about the SugarBeans.
Here is the list of possible attributes for fields.’name’ = The name of the field
Fields Array
• ‘vname’ = The language pack id for the label of this field. The language pack is located in the
language directory of each module and may include the main language file in includes/language.
• ‘type’ = The type of the attribute
• ‘relate’ = Related Bean (related to another table)
• ‘link’ = A link as defined by a relationship
• ‘id’ = An ID number (36 character ID number)’
• ‘datetime’ = A date and time
• ‘date’ = A date
• ‘bool’ = A boolean value
• ‘enum’ = An enumeration (drop down list from the language pack)
• ‘char’ = A character array
• ‘assigned_user_name’ = A linked user name
• ‘varchar’ = A variable sized string
• ‘text’ = A text field. Basically a ‘char’ that holds 65,535 (2
16
– 1) characters (I think)
• ‘phone’ = A phone number
• ‘email’ = An Email address
• ‘int’ = A number
• ‘function’ = Gets the value from a function
• ‘validation’ = example. array(‘type’ => ‘isbefore’, ‘compareto’=>’date_due’),
• ‘table’ = The table this field comes from
• ‘isnull’ = Is this field allowed to be set to null? Can be set to ‘true’ or ‘false’.
• ‘len’ = The length of the field (number of characters if a string)
• ‘options’ = The name of the enumeration in the language pack for this field. See ‘vname’ above
for details on the language pack. This is only used for type ENUM fields.
• ‘dbtype’ = The database type of the field (if different than the ‘type’). It seems to take the samevalues as ‘type’.
• ‘reportable’ = Should this field show up in the list of fields for the reporting module (if
applicable, PRO and ENT versions only).
• ‘required’ = true if this field is a required field
• ‘default’ = The default value for this field
• ‘massupdate’ = false if you do not want this field to show up in the mass update section at the
bottom of the list views. Defaults to true.
• ‘rname’ = (for type relate only) The field from the related variable that has the text
• ‘id_name’ = (for type relate only) The field from the bean that stores the id for the related Bean
• ‘source’ = This can be used for calculated values or values retrieved in some other way.
• ‘nondb’ = the field value does not come from the table that the vardefs refers to. It comes
from another table, mostly “users” as this source type is mostly used to retrieve the user
name for assigned_user_id and modified_by fields and the like.
• ‘function’ = Gets the value from a function
• ‘sort_on’ => The field to sort by if multiple fields are used.
• ‘fields’ => (for concatenated values only) An array containing the fields that are concatenated.
• Example: array(0=>’first_name’, 1=>’last_name’)
• ‘db_concat_fields’=> (for concatenated values only) An array containing the fields to concatenate
in the DB
Indices Array
This array contains a list of arrays that are used to create indexes in the database.
The fields in this array are:
• ‘name’ = The name of the index. This must be unique in most databases.
• ‘type’ = The type of the index (primary or index)
• ‘fields’ = The fields to index. This is an ordered array
Relationships Array
The relationships array is used to specify relationships between Beans. Like the Indices array entries, it is
a list of names with array values.
The possible attributes of a relationship entry are:
• ‘lhs_module’ = The module on the left hand side of the relationship
• ‘lhs_table’ = The table on the left hand side of the relationship
• ‘lhs_key’ = The primary key column of the left hand side of the relationship
• ‘rhs_module’ = The module on the right hand side of the relationship
• ‘rhs_table’ = The table on the right hand side of the relationship
• ‘rhs_key’ = The primary key column of the right hand side of the relationship
• ‘relationship_type’ = The type of relationship (‘one-to-many’ or ‘many-to-many’)
Read More : http://dl.sugarforge.org/sugardocs/Notes/VardefsDocumentation/Vardefs.pdf