×

GoHighLevel Custom Code Guide

GoHighLevel Custom Code Workflow Action Guide

The Custom Code workflow action in GoHighLevel lets you run JavaScript inside automations, giving you flexibility similar to tools like ClickUp while keeping everything in one CRM. This guide walks you step by step through using Custom Code safely and effectively so you can extend native automation features without hiring a developer.

Below you will learn how to add the Custom Code action, configure inputs and outputs, write and test your script, and understand important limits you must follow to prevent workflow failures.

What Is the GoHighLevel Custom Code Action?

The Custom Code action in GoHighLevel is a workflow step that executes server-side JavaScript. It is designed for advanced users who need logic or data processing that is not available through standard workflow actions.

Use cases include:

  • Advanced calculations and conditional logic
  • Transforming or cleaning data before saving it to fields
  • Preparing values to use in later workflow steps

All processing happens inside the GoHighLevel environment, and the result can be passed to a workflow variable for use later in the same automation.

Requirements and Limits in GoHighLevel Custom Code

Before adding a Custom Code step, you need to know the technical constraints imposed by GoHighLevel. Ignoring these limits can break your workflows.

Execution Time Limits in GoHighLevel

Your script must complete quickly. The Custom Code action has a maximum execution time of 3 seconds. If your code does not finish within this time, the action fails and the workflow may not behave as expected.

To stay within the time limit:

  • Avoid complex loops and heavy computations.
  • Keep your logic as simple and direct as possible.
  • Optimize string and array operations.

Package and Feature Restrictions

Not all JavaScript features work in this environment. The GoHighLevel Custom Code runner does not support:

  • Third-party NPM packages or imports
  • External HTTP requests (no fetch, axios, or other network calls)
  • Promises or async/await that depend on network I/O

This means your code must be self-contained and rely only on core JavaScript and the inputs provided by the workflow.

How to Add a GoHighLevel Custom Code Action to a Workflow

Follow these steps to insert the Custom Code action into an existing automation:

  1. Open your Workflows section inside GoHighLevel.
  2. Select the workflow where you want to add the logic.
  3. Click the plus icon to add a new action at your desired position.
  4. Search for and select Custom Code.
  5. Click the new Custom Code action to open its configuration panel.

Once added, you can configure inputs, write your script, and set up outputs that other workflow steps can use.

Configuring Inputs in GoHighLevel Custom Code

Inputs are values you send into the Custom Code action from the workflow. They allow you to use contact data, custom fields, or prior workflow results inside your script.

Types of Inputs You Can Use

Inside the Custom Code action, you can create multiple input variables. Each variable can be mapped from:

  • Contact fields (name, email, etc.)
  • Custom fields you have defined in GoHighLevel
  • Static values typed directly into the action

These mapped values are passed to your script as properties on a single input object.

Naming and Referencing Inputs in GoHighLevel

When adding an input, you must specify a variable name. This name becomes the key inside the input object that your JavaScript uses. For example, if you name an input firstName, your script can reference it as input.firstName.

Guidelines for naming inputs:

  • Use simple, descriptive names (for example: firstName, planType).
  • Avoid spaces and special characters.
  • Use consistent casing so your script is easy to read.

Writing JavaScript in GoHighLevel Custom Code

The code editor inside the Custom Code action is where you write the logic that processes inputs and sets the output.

Accessing the Input Object in GoHighLevel

All values you mapped as inputs are bundled into a single input object. Typical usage looks like this:

  • input.firstName – for a contact’s first name
  • input.email – for an email address
  • input.customField – for a mapped custom field

Use these values to perform calculations, concatenations, or any other supported JavaScript operations.

Setting the Output Value

Your script must assign the result to an output variable. This variable is what later workflow steps in GoHighLevel will read. For example:

// Example: Build a greeting using the first name
const name = input.firstName || "there";
const greeting = `Hello, ${name}!`;
output = greeting;

After this code runs, the workflow can reference the Custom Code output to use the greeting in emails, SMS, or internal actions.

Using the GoHighLevel Custom Code Output in Workflows

Once your JavaScript is configured, you can use the output in other workflow actions. The platform exposes a special variable option representing the result of the Custom Code action.

Referencing the Output Variable

The output is available as a workflow variable that you can insert into supported fields. When editing a later action, open the variable picker and select the Custom Code output entry associated with this step. The exact label will depend on how the system names the action, but it will reference the Custom Code result.

Typical ways to use the output in GoHighLevel include:

  • Personalized email or SMS content using processed text
  • Routing logic based on derived values (for example: high-value vs. low-value leads)
  • Storing the result in a custom field for later reporting

Testing and Troubleshooting GoHighLevel Custom Code

Because Custom Code can affect critical automations, you need to test thoroughly before deploying to live workflows.

Best Practices for Safe Testing

  • Use test contacts and a separate test workflow whenever possible.
  • Start with simple scripts and expand them gradually.
  • Log values with temporary console.log statements if supported in the environment for debugging.

If the Custom Code step fails, check for:

  • Syntax errors in your JavaScript
  • Input names that do not match the keys you reference
  • Operations that may take too long and exceed the time limit

Security and Data Handling in GoHighLevel Custom Code

The Custom Code action processes data inside the GoHighLevel infrastructure. However, you are responsible for:

  • Not copying sensitive data into logs or external systems
  • Keeping scripts minimal and purpose-driven
  • Ensuring calculations do not expose private details in messages

Since network calls and external packages are blocked, data remains within the automation context, reducing the chance of accidental leakage to third-party services.

Helpful Resources for GoHighLevel Users

To go deeper with automation strategies and advanced configuration around Custom Code in GoHighLevel, you may find consulting or implementation partners helpful. One such resource is Consultevo, which focuses on CRM and marketing automation solutions.

For the official documentation on the Custom Code workflow action, review the original article on the GoHighLevel help center here: GoHighLevel Custom Code Workflow Action.

By understanding the environment limits, using well-structured inputs and outputs, and following safe testing practices, you can confidently extend your GoHighLevel workflows with Custom Code and unlock more powerful automation scenarios without leaving your CRM.

Need Help With GoHighLevel?

If you want expert help building, automating, or scaling your GHL , work with ConsultEvo — trusted GoHighLevel Partners.

Scale GoHighLevel

“`