abstra-docs
Search…
Execute JavaScript code
The Execute JavaScript code action executes some custom JavaScript code. It lets you control the flow of your actions in case of success or in case an error is thrown.
You can type some JavaScript code to be evaluated in our code editor.
Just like our JS mode for other arguments, you can reference variables inside your JavaScript code using the $. prefix. Example, assuming you have a variable post with a content property, you can access it as follows:
1
function getPostContent() {
2
return $.post.content;
3
}
4
getPostContent();
Copied!
You are not restricted to define and call functions inside the code argument, any valid JS code snippet can be executed. Example:
1
const foo = "bar";
2
console.log(foo);
Copied!
You can trigger subsequent actions in case of success or error. The example below shows the message Success when the code executes without any errors and shows the message Error when the code throws an error.
Last modified 5mo ago
Copy link