Creating a Pipeline Function

How to Create a Pipeline Function

Open the Function Editor, look for a data source labeled “Pipelines”, and click the “+” icon. Then, give your function a name.

Configure

Configure the first step. Choose from Function, Execute Javascript, Condition, or Loop. Learn more about configuring each action type.

Each action you add may have parameters. For example, this first step “get customer record” (from a PostgreSQL database) has a required parameter “id”.

If unresolved, this “id” becomes a required parameter for this Pipeline Function. You can then configure the “id” parameter later when you’re building a specific app (e.g. scheduled automation, a button that executes the pipeline function, etc).

Or, you can choose to resolve the parameter now by defining its value.

Add your next Action and configure it to meet your use case. You can add as many steps as you’d like to your Pipeline Function.

At any point, you can run your function to see that it is working. Just keep in mind that the Pipeline Function actually executes in the environment you specify. In many cases, you may want to run it against a non-production environment.

Before using your Pipeline Function, make sure that the Inputs tab and Outputs tab include the parameters and attributes you expect to see.

Transform

Your Pipeline Function returns data from its last step. Add a transformer to manipulate the returned value using Javascript.

Inputs

Inputs will auto-populate when you add steps to your Pipeline Function with parameters that are unresolved. These inputs become your Pipeline Function’s parameters.

Note that each parameter name must be unique. In some cases, you may have added two steps that each have the same parameter name. For example, a Get User function that has an “id” parameter and a Get Company function that also has an “id” parameter. If both parameters remain unresolved, you’ll see an error.

This error will go away once you provide unique names for each parameter.

Outputs

If your Pipeline Function needs to return data, you’ll need to make sure that the expected Attributes appear here.

If your last step is a Function execution, the Outputs will auto-populate with the attributes already defined in that function’s configuration. No additional action is required and you’re ready to use this Pipeline Function.

If your last step is a Javascript action, you have two options for populating the Output section.

  1. Run the function first. Then, go to the Outputs tab. You should see an option to get outputs from the last execution.
  2. Manually define your outputs.

If your last step is a Conditional action, you’ll need to add a JavaScript step afterwards to specify what data you are expecting to return.

Filters

Adding a filter to a pipeline configuration uses JSON inputs that are included in the body of the transaction and should be configured using the attribute keyword:

[
  {
    "value": "${org_id}",
    "operator": "=",
    "attribute": "organization_id"
  }
]