Formula Editor
The Formula Editor allows you to create formula based Custom Fields and Business Rules.
When creating formula based custom fields the formula editor is displayed to the right of the formula window.
When creating workflow and validation rules, the formula editor can be accessed by clicking on the "Advanced Formula Options" link,
which can be found within the evaluation criteria, and certain actions.
Formula Functions
The Formula editor contains a plethora of available functions that can be used to create the formula.
Different functions are used for different result types, and some functions are only available for Business Rules.
Be sure to review the Formula Editor Functions page to see a full list of all available functions and examples of each.
Inserting Fields
To insert a field into a formula either click on the "Insert Field" button within the Formula Editor and
select the needed field or manually enter the field API name.
Custom fields will have an API name upon creation, and can be found within the "Insert Field" list.
To view fields of related objects, such as linked customer fields, click on the relevant object (in blue).
Inserting Objects
To insert a specific object into a formula click on the "Insert Object" button within the Formula Editor.
This is used to reference other object within the system.
For example, if you are creating a custom field that references a specific job title, click on Job Title under the Resource Entity, and choose from the list of Job Titles that is displayed in the window.
Inserting Picklist Values
To insert or view picklist values for a specific field of type "picklist", click on the "Picklists" tab and search for the relevant field.
The entity to which a picklist is displayed is written in brackets prior to the name of the picklist.
To view the list of values linked to the picklist, click on the picklist name.
Operators
To add an operator into a formula, click on the "Insert Operator" button within the Formula Editor.
The available operators are as follows:
+ Add
- Subtract
/ Divide
* Multiply
( Open Parenthesis
) Close Parenthesis
= Equal
<> Not Equal
< Less Than
<= Less Than or Equal
> Greater Than
>= Greater Than or Equal
&& And
|| Or
Not Not
Variables
The Variables tab allows you to add any variable defined within a Workflow Rule into a formula.
This is particularly useful when using the New Object action, looking to access organization variables and fields, or when setting user inputs in the Custom Actions rules.
Variables can include both the variable itself and any fields within the variable.
- Variables that can be accessed via the Variables tab include
- Fields on the Organizational level
- Variables created when using the New Object action
-
- These include the NewObject object as well as all fields related to the new object
- TargetObject and LinkObject as set when creating workflow on related
- User Input variables created in Custom Fields
Formula Standards and Constants
There are a set of Formula Standards and Constants that can be used when creating formulas.
These include:
- Null
- Used when stating either stating that an object should be NULL or when determining if an object is NULL
For Example - if creating a workflow rule to Update a Field to Null write
$Description = NULL
- \n
- Sets a carriage return in a string
"state changed manually to: " +ToString($TRackStatus)+ "\n" + GetPreviousValue($AdditionalComments)
- TRUE/FALSE
- Can be used to check if a value is equal to TRUE or FALSE
- "" or ' '
- Quotes can be used for strings, or to determine the value of a picklist field.
IsManuallySet($TrackStatus) && $TrackStatus = "Off Track"
- ,
- A comma is used to separate values
If(In($JobTitle.Name, "Developer", "DBA","QA Engineer"), 70,100)
Regex
A regular expression that can be used for searching/formatting.
Examples
This adds commas to numbers in text:
RegexReplace("Text Text 1000000 Text Text Text 1231648946 Text Text Text 974651633843 Text Text 1324", '([0-9])((?=([0-9]{3})+ )|(?=([0-9]{3})+$))', '$1,', FALSE) = "Text Text 1,000,000 Text Text Text 1,231,648,946 Text Text Text 974,651,633,843 Text Text 1,324"
This removes trailing zeroes:
RegexReplace("123.456000", '0*$', '', FALSE) = "123.456"
This removes leading zeroes:
RegexReplace("000.123456", '^0*', '', FALSE) = ".123456"
Formula Functions
Detailed information about the formula functions, including examples, can be found here