How to: Trigger Transforms in the Module Builder

To trigger a transform in the Module Builder, use the Plug-In component. In this article, you'll learn the different ways you can trigger your transforms in the Module Builder. You'll also configure your Plug-In for what you want the output of your transform to do. Here are a couple of ways you can trigger your transforms:

  • Execute with Input Data

  • Pre-Request Transform

One way to trigger your transform is to select Execute Transform with Input Data from the Internal Services drop-down menu. You can use this service to reference any transform in any module in your environment. You can also specify which fields you want to transform in your submission data. To reference the transform and your fields, you'll enter the right inputs into your Plug-In. Then, using these inputs as the API call's request body your Plug-In component executes your transform.

In the Plug-In component's Inputs table, you'll enter the following: 

A static image displaying a Plug-In component's configuration window. The Internal Service is set to Execute Transform with Input Data

Let's move on to your Plug-In component's Outputs table. You'll fill in the Outputs table based on your transform type. For an Input transform, you'll map the information coming out of the transform to fields in your module. This overrides the original information. For an Output transform, you'll map the information coming from the transform to where it'll go. This could be text, JSON data, or a PDF.

Your Execute Transform with Input Data outputs your transformed data as an object.

So, you'll enter the component Property ID in the Property ID column of the Outputs table. Then, you'll enter the data type of your transform in the Mapping column. You'll write your mapping based on the following data types: 

Data Type Mapping

JSON data

jsonData

Text

txtData

PDF

pdfUrl

You can also map your transform output to XML format. We'll cover mapping to XML in another lesson.

For example, say you use an Input transform that transfers data into JSON. You want to store that data in a Hidden component. So, you'd enter dataTransform for the component's Property ID. Here's how the Outputs table would look: 

A static image displaying a Plug In component's Outputs table.

Now that you know how to trigger your transforms using Execute with Input Data, let's move on to a different method.

You can also trigger a transform in the Module Builder by selecting a transform from the Pre-Request Transform menu. To display the Pre-Request Transform menu, set your Plug-In component's Request Type to PATCH, POST, or PUT.

A Pre-Request Transform is the first in a two-step process. First, the Pre-Request Transform step transforms your data. Then, it uses your transform output as the input for your Plug-In component. That way, you’ll use the Pre-Request Transform to use your transformed data directly in an API call. To transform data with a Plug-In component, you’ll use Execute Transform with Input Data as the trigger.

To set up a Pre-Request Transform trigger in your Plug-In component, do the following: 

These instructions assume you have a new module open, saved, and with a title. These instructions also assume you have added a Plug-In component to your Module Builder canvas.

1. Open the Plug-In component that you'll use to trigger your Pre-Request Transform.
2. Select which Service Type you'll use for your transform.
3. Select which Internal Service or External Service you'll use for your transform, if applicable. Your Pre-Request doesn't require you to select a service.
4. From the Request Type drop-down, select PATCH, POST, or PUT. Selecting one of these options causes the Pre-Request Transform drop-down menu to appear under Service Type.
5. Select your transform from the Pre-Request Transform drop-down menu.

To select a transform, you must first create one in the Module Builder. For more information on how to create a transform, search for Transforms Sidebar Option in our In-Product Help.

A static image displaying a plug in component's pre-transform setting.

When you use a Pre-Request Transform trigger, the API call’s request body won’t need the Plug-In’s Inputs table. Instead, the API call’s request body is the output of your executed transform. So, when using a Pre-Request Transform, leave the Inputs table empty. Note that Pre-Request Transform only uses transform parameters as your request body. Meaning that you can only select transforms saved to the module you’re in.

As you just learned, the Pre-Request Transform uses your transform as the request body of your API call. That means your transform must include the input parameters to run as expected.