Skip to main content
Version: 1.28 (Current)

Execute Javascript Code And Continue Execution

Audience: Low-code Engineers

Skill Prerequisites: Actions, JavaScript, Tokens

Runs JavaScript code in the user's browser, then carries on with the next actions. It's available in forms and listings.

The code is sent to the browser as soon as the action runs, and the browser runs it right away. Meanwhile, the server keeps running the remaining actions. In a form, the code can read and change fields through the form object, for example form.fields.TextBox.value.

Typical Use Cases​

  • Show a "please wait" message or change the page before a long-running action, such as a large SQL query
  • Hide an element or scroll the page, and still run the rest of the actions
  • Call a third-party script on the page, such as an analytics event, as part of a submission

Don't use it to​

Action NameDescription
Execute Javascript Code And Stop ExecutionRuns JavaScript in the browser and ends execution.
Execute JavaScript (Server-side)Runs JavaScript on the server.
Display Toast Message And Continue ExecutionShows a short notification and continues, without writing code.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
Javascript CodeThe JavaScript to run in the browser. Tokens such as [FirstName] are replaced with their values on the server before the code is sent. In a form, fields are also available as form.fields.<FieldName>.value.Yesempty stringNo

How the code runs​

  • Tokens are replaced as plain text. Values aren't escaped for JavaScript. Put tokens inside quotes, for example '[FirstName]'. A value that contains a quote or a line break breaks the code, so read user input from form.fields instead of tokens.
  • The form object is available in forms. form.fields.<FieldName>.value holds the current value of a field. It isn't available in listings.
  • Errors don't stop the actions. The code is wrapped in a try/catch. If it throws, the error is written to the browser console, starting with Execute JsCode Action Error, and the next actions still run.

Considerations​

  • Scripting license. The action needs the Standard.Scripting feature. If it isn't licensed, the action fails with an error. System pages skip this check.
  • Timing. The code runs while the server is still working. Anything it changes on the page may be replaced by what the following actions do, for example a redirect or a message that ends execution.
  • Field changes don't reach the current submission. The server already has the submitted values. If the code changes a field, the following actions still see the old value.
  • Visible to users. Don't put passwords, keys or other secrets in the code or in the tokens it uses.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Show a notice before a long-running step​

This action shows a notice in the form's StatusMessage element. The actions after it, such as a slow SQL query, continue on the server.

{
"Title": "Execute Javascript Code And Continue Execution",
"ActionType": "ExecuteJsCodeAndContinue",
"Description": "Tell the user the report is being built",
"Parameters": {
"JavascriptCode": "var el = document.getElementById('StatusMessage');\nif (el) { el.textContent = 'Building your report. This can take a minute...'; }"
}
}

2. Send an analytics event after a sign-up​

This action sends a sign_up event to Google Analytics, if it's loaded on the page. The [PlanName] token is placed inside quotes. The remaining actions still run.

{
"Title": "Execute Javascript Code And Continue Execution",
"ActionType": "ExecuteJsCodeAndContinue",
"Description": "Track the sign-up",
"Parameters": {
"JavascriptCode": "if (window.gtag) {\n gtag('event', 'sign_up', { plan: '[PlanName]' });\n}"
}
}

Revised 09/26/2026