If you’ve used Workflow Automation, you’ve probably seen that you can customize them using formulas. Here we’re going to walk through the most common formulas and how to use them, including:
This article is meant to be a quick reference sheet. For a full comprehensive list of formulas, check out this article here.
1. CURRENTDATE()
What does it do?
This function returns the date that your automation was triggered. So if your Workflow Automation is triggered on October 14th 2021, this function will return 2021-10-14.
Please note that nothing goes in the brackets; you can simply copy and paste this formula into your workflow automation: CURRENTDATE()
How do I use it?
A common way to use this function is to populate a date field. For example, if your Workflow Automation creates a Task, you can use this function to set that Task’s due date to the same day it was created.
You can also use CURRENDATE()
in combination with other functions such as DATEADD()
.
2. DATEADD(x,y)
What does it do?
This function takes a date (x) and adds some number of days to it (y). For example, to add 10 days to an Opportunity’s Close Date, you would use DATEADD(close_date,10)
.
This function can also be used to subtract days. Simply make the number negative: DATEADD(close_date,-10)
How do I use it?
This function is commonly used to populate a date field such as a Due Date or Close Date.
It’s very common to pair this function with CURRENTDATE()
; this allows you to add some number of days to the current date!
For example, if you want to create a Task that is due ten days from now (or rather, from when the workflow automation is triggered), you can use this formula: DATEADD(CURRENTDATE(),10)
3. Mathematical Operators (+, -, * and /)
What does it do?
These are mathematical operators just like in a calculator.
+
and-
add and subtract, respectively*
and/
multiply and divide, respectively
This enables us to do calculations on our fields in Copper. You can combine several of these functions into a single formula if you need to do multiple additions, subtractions, etc. And you can use brackets to ensure they operators are applied in the correct order. For example, (1+2)*3
will return 9
.
How do I use it?
A common way to use these is for calculating commission. Let’s say for example we have some sales reps who earn 5% commission on an Opportunity. In the workflow automation, you would set your formula to: monetary_value*0.05
If your commission rate varies, you can build a custom field to store that percentage. Just remember that percentages are stored as integers (e.g. 5% is equal to 5, not 0.05) so remember to divide by 100: monetary_value*cf_commission_rate/100
Click here for our full Workflow Automation Recipe for calculating commission.
4. CONCAT (x,y)
What does it do?
This function takes two or more pieces of text and combines them into one.
How do I use it?
This function is commonly used for naming Tasks or Opportunities. For example, you might have a workflow automation that sets a Task to draft a contact. Using this function, you can set the name of the Task to include the name of the Opportunity: CONCAT(‘Draft contract for: ‘,name)
In this example, if my workflow automation is triggered off an Opportunity called Consulting Package - AWG Co then the resulting Task will be called Draft contract for: Consulting Package - AWG Co.
These are just a few of the most common formulas. We have tons more you can learn about here. And if you have any questions, feel free to post them in the Community!