Defining a Condition with Formulas
Use the Formula Builder to define conditions with formulas. Formulas are evaluated at the time a workflow triggers or an action or transition executes. Formula definitions can include internal field IDs, SQL functions, JavaScript, SuiteScript, and mathematical operators. You can manually enter formulas or develop them using the Formula Builder.
Rules and Guidelines for Using Formulas
To avoid errors with formulas, adhere to the following rules and guidelines.
-
The type of functions you can use depend on the type of trigger set for workflow initiation, or action or transition execution.
-
SQL functions execute on the server, while JavaScript and SuiteScript execute on the client. Therefore, use SQL functions with server triggers, and use JavaScript and SuiteScript functions with client triggers. You cannot use client triggers for workflow initiation or transitions.
-
If a formula references a custom field internal ID and the internal ID changes, you must update the formula with the new internal ID.
-
Invalid formulas can break a record form. Consequently, users will not be able to create or edit records. Therefore, thoroughly test your formulas before activating the workflow.
Formula Builder Parameters
You can find the Formula Builder's parameters and a description of how to use them in the following table:
Parameter |
Description |
---|---|
Function |
Select an SQL or JavaScript function to include in the formula. When you select a valid function, it populates in the Formula text box; otherwise, it will not appear. The list of functions is not exhaustive. You can use in formulas functions that do not appear in the list. Different functions appear in the list depending on the workflow, action or transition trigger type. |
Join |
Select a record type that can be joined with the base record type for the workflow. You can then source a value of a field from the joined record. This option is only available in conditions where the workflow element uses a server side trigger. |
Value Field |
Select the Field from the workflow base record or from the joined record that you want to use in the formula. The Formula Builder enters the internal NetSuite ID for the field in the Formula. |
Formula |
The formula automatically populates in the Formula field with the selected options from the Formula, Join, and Value Field fields. You can modify the formula's logic by manually editing it in this field. You can also manually type the formula in this field. This is useful when the function you need to use is not available in the Function list. It's also a convenient way to modify the logic of the formula created by the Formula Builder. |
To create a formula with the Formula Builder:
-
Open the workflow definition, action, or transition definition.
-
Select Custom Formula in the Condition section.
-
Click the Open icon to open the Condition Builder.
-
Enter your condition criteria. For more information, see Formula Builder Parameters.
-
Modify the function's argument placeholders by substituting the placeholder with the field id you want to use in the formula.
For example, to test if the length is greater than 10, replace:
LENGTH(char){custrecord65}
with:
LENGTH({custrecord65}) > 10
-
Click Set to return to the workflow, action, or transition definition.