Browse the Knowledge Center
Workflows
Expressions: text, maths and dates
Making a workflow field calculate its value. Switch the field from Fixed to Expression and wrap logic in a curly bracket and percent sign; inside it is plain JavaScript and variables keep double curly brackets. Examples trim a first name, fall back to No phone with two pipes, and count days since creation using Date.now(). An expression with a mistake does not stop the workflow, it comes out blank, as with a misspelled floor. Use it for text, maths and dates.
Transcript
An expression lets a field work out its value, instead of just copying one. Switch the field from Fixed to Expression, and wrap your logic in a curly bracket and a percent sign. Inside, it's plain JavaScript, and variables still use double curly brackets. In the title, drag in the first name and add.trim(), so stray spaces disappear. In the body, drag in the phone number, then two pipes and a fallback: when the phone is empty, the task reads "No phone". Maths and dates work too: take Date.now(), subtract the creation date, and divide by the milliseconds in a day, to get how many days the contact has been in your CRM. Then check it on a run. An expression with a mistake doesn't stop the workflow. It just comes out blank. Here the days are missing, because floor is misspelled. Every Wednesday, Jonas asks Claude to polish his call tasks. Claude writes three expressions and fixes the blank one. Claude, ChatGPT or any assistant you connect to Vetta works on your real workspace, so test every expression, then give it a bigger job each week. In Vetta, read the test run, then activate it yourself.
Read the article: Variable expressions