Evaluate JavaScript is an action that runs your own JavaScript code in your app. You can add it to a button or a step trigger in a flow, or to a button in a banner, to trigger behaviour or integrations in your app. It's sometimes called "Enhanced JavaScript".
How do I add an Evaluate JavaScript action?
Open the flow or banner and select the button or step trigger.
Add an action and choose Evaluate JavaScript.
.png)
Enter the code to run.
.png)
For the other actions a button or trigger can run, see Which actions can a trigger or button run? in Flow builder basics.
User attributes vs. company attributes
We recommend using user attributes in Evaluate JavaScript. They give consistent results, while company attributes need extra setup.
How do I use a user attribute in Evaluate JavaScript?
Insert a user attribute with double curly braces, and wrap it in quotes so the result is valid JavaScript:
Text, numbers, lists, or dates: use single (') or double (") quotes around the braces.
const email = '{{email}}';const locale = "{{locale_code}}";Multi-line text (for example, an attribute bound to a multi-line text survey question): use backticks (`) instead, because a line break inside single or double quotes breaks the code. The backtick key is to the left of the 1 key on a QWERTY keyboard.
const feedback = `{{user_nps_feedback}}`;Passing an attribute to a function in your app: put the quoted attribute inside the function's parentheses.
openForm('{{user_nps_score}}');
To save survey answers as attributes you can use here, see Surveys/NPS.