Skip to content

Creating JavaScript Functions

JavaScript functions are small pieces of code you write once and reuse across ProcessPlan. They run in a secure, isolated environment and can be used to:

Functions are managed under Administration > Integrations > Code / Functions. The list shows each function’s Function Name, Modified By, Modified Date, and Last Used.

  1. Click the New Function icon at the top of the list

  2. Enter a Function Name and save. The code editor and the sections below then appear

  3. Write your code in the JavaScript Code editor. Every function must define an execute function:

async function execute(event, helpers) {
// event.customerName - your parameter values as key/value pairs
// helpers.http.get(url) - HTTP GET request (also post, put, delete)
// helpers.env.API_KEY_NAME - access your saved secrets and environment variables
return {
message: 'Hello from ProcessPlan code!',
data: event,
};
}

The Description for AI Agent Mode field is a brief description of what the function does. Fill it in if you want AI agents to be able to use the function: the description is how an agent understands when the function is the right tool for the job.

The Parameters section defines the inputs your function accepts. Wherever the function is used (an automated action, a field, an AI agent), each parameter appears as its own input.

Click the Add Parameter icon and complete:

  • Parameter Name - The property name used when passing values to the function (no spaces, case sensitive). Read it in your code as event.yourParameterName

  • Default Value (optional) - Used when no value is provided at runtime

  • Required - Check if the function should not run without this parameter

Reference any of your saved secrets and environment variables in code as helpers.env.YOUR_VARIABLE_NAME. They are detected automatically and made available when the function executes, so API keys and shared settings never need to be pasted into the code itself.

Click Run Test to save and run the function using the default parameter values. The output appears below the button, so you can confirm the function returns what you expect before connecting it to an action or a field.

  • Functions must finish within 35 seconds

  • Functions run in an isolated environment and cannot load external modules (require and import are not available)

  • The Last Used field on the function shows the last time anything executed it