vtiger510:Module Field Formulas
From http://wiki.vtiger.com/archives
| Faq | Howto |
Contents |
Field Formulas
About
Field formulas is a feature provided with vtiger which allows you to define custom rules for custom fields. This gives you the ability to auto fill values of different fields based on formulas and/or conditions. The feature is in the form of an extension module (which is optional).
Features
This feature basically allows the Admin user to set formulas for the custom fields. Based on this, the value in the custom field is calculated and auto-filled. Using this feature, an admin can define his own rules to the custom fields and get the desired value for that field automatically, each time the record is saved.
To Add Field Formula
In order to add a field formula to the Custom fields -
- Go to Settings >> Module Manager.
- In Module Manager page, you will find a list of modules.
- Go to settings page of a particular module you need; by clicking the settings icon at the right corner of that module.
- You will find Field Formulas link on the module's settings page (If Field Formulas is supported for that module).Click on it.
- You need custom fields in order to create formulas in vtiger. In case no custom fields are present, it displays a link to create custom fields for the particular module. Once you have custom fields for the module, you can add formulas to those fields.
- If the custom fields are present, it shows the list of custom field with formaulas created to it.
- To add a new field formula, click on New Field Expression button.
- It opens a Edit Expression popup window.
- Select the Target field from dropdown, which gives a list of custom fields of selected module.
- Define an expression in the provided text area.
- You can use the dropdown provided in vtiger to select the field value and in-built functions defined.
- In your expressions, you can use the column names without $. All the string constants needs to be enclosed within " " (double quotes).
- After defining expression, click on Save. Return to the selected module, checkout the results of the expression of a related custom field.
Examples
Lets say we want to create formulas for the Leads module such that two custom fields are populated, the conditions being -
Condition 1: if mailingcountry == "India" then concat(firstname," ",lastname)
else concat(lastname," ",firstname)
Condition 2: annual_revenue / 12.
Now whenever a Lead is saved, these two custom fields will get their values from the defined formulas.




