General
With Dynamic Field Formulas, you can for example count values, create conditional clauses, edit fields’ information, etc. within a single CRM-service entity. With Dynamic Fields Formulas, you can also seek information from another module to the entity or count values for rows. It’s also possible to have a certain information field to show on the right side of the entity when the entity is opened and the condition is met.
Start
Management of dynamic field formulas can be found in the settings of each module, accessed by going to Settings → Module Manager and pressing the button for the desired module. The formulas themselves can be accessed from the Dynamic Field Formulas menu.
A new formula is created using the New formula button. The “Run” field specifies whether the formula is run, for example, when creating an entity, saving, or retrieving data from another field. The “Field” field is used to select the target field where the value will be stored. “The ‘Formula’ field defines the desired formula.
NOTE! The formula must be consistent and must not be lined up with the Enter key.
The new formula is activated by clicking the Activate option under the Actions header.
Active formula which is run when the condition under the Run header is fulfilled.
The disabled formula is marked with a red background.
Running the formulas
The formulas of dynamic fields are run when creating the entity, when information is fetched to other field, or between clicking the Save button and the actual saving to the database. The detail view formulas are checked when the entity is opened in CRM.
- If the formula is run On save, the run is done every time the Save button is clicked after editing the entity.
- If the formula is run On create, the run is done when the entity is first created.
- If the formula is run On Validation, the run is done when the Save button is clicked. The formula then checks the content of the field and if the content is not valid, the formula displays a warning and interrupts saving the entity. A validation formula is done using this run option.
- NOTE: On Field formulas work only in the legacy version of the system.
- When using run On Field, only the relation fields, meaning fields ending with id (account_id etc.) will work.
Things to consider when running formulas
If the formula is run either “On save”, please note, that it is only run if the entity is saved in edit mode. Thus, the formula will not be run if the formula’s target field is edited with quick edit or mass edit, or data is imported to the field through CSV or integration.
With Run Formulas, you can run all the formulas at once for the module you are in. This enables for example updating information and editing from one field to another if there is for example a maintenance break. This function overwrites information in all existing entities in the module according to the formulas. You can run all the formulas for up to 5,000 entities at once.
The formulas are run in the order they are shown on the list. You can change the order by dragging formulas up and down the list (See picture below). When using static variables the order is critical since the variable can only be used in formulas that run after the formula which creates the static variable.
Row-level field formulas are always run last, so the order of the formulas on the list does not have so much impact on row-level formulas and placing the row-level formula first only means that the row-level formula in the first place will be the first row-level formula to be run.
Limitations
- Relation fields can’t be a target field of the dynamic field formula.
- In modules that have row-level fields (e.g. Invoices, Sales Orders, Quotes), the information on rows can not be used in a dynamic formula for a main-level field or vice versa (read more about row-level formulas further below).
Limitations on row-level fields
- The row-level fields’ formulas can be run only either “On save” or “On create”.
- In row-level fields’ formulas, you can not fetch information from the fields at the main level (e.g., the quote’s name, due date, or other “normal” fields) or vice versa.
Dynamic Formulas in Row-Level Fields
You can also create dynamic formulas for row-level fields that e.g. quotes, sales orders, and invoices have. This feature isn’t enabled by default, but you can activate it in Settings → Additional Settings by activating Enable inventory row field formulas field in Row-Level Functions.
Formula types
Information formula
Information formulas allow the system to provide users with a notification that is activated if a condition specified in the formula is met.
The notifications are divided into four different types and the user can change the text to whatever suits the situation best:
Danger:
Warning:
Information:
Success:
Validation formula
Validation formulas can be used, for example, to ensure that the value entered in a field matches the criteria set for it. Criteria can be, for example, the length of the value to be entered or the possibility to enter only a numeric value. Validation formulas can also be used, for example, to prevent the creation of entities with the same name in a module – such formulas can be used, for example, to prevent the creation of two account entities with the same name.
Schedule dynamic field formulas
Formulas can be scheduled and run in the background for example to do calculations without opening and saving the entity. Learn more about how to do scheduled field formulas from here: Scheduled Tasks.
Formulas triggering on workflow
The combination of workflow and dynamic field formulas allows users to update data outside the saved entity. More information on this is available in the Update information to linked entity.
Examples of formulas
We have collected information about writing field formulas and the most commonly used formulas in our article Examples of dynamic field formulas.