Skip to main content

Encode Parameters to Avoid Custom Action Errors

Most custom actions rely on API requests to a third-party application, which generally requires passing in various parameters to find the data you're looking for or to perform a specific process. When using values that are user-generated or otherwise dynamic, you run the risk of passing in special characters that aren't supported, potentially resulting in a server error.

For example, you might have a custom action to retrieve customer data using their email address as the unique identifier. If this email address contains a special character, like a plus, "+", that character may be interpreted by the server as a space and cause unexpected behavior.

To avoid this, we recommend that you encode any paramters that might contain special characters using the Encode URL formula in your custom action request:

  1. Navigate to the data source and, in the data source configuration panel, select Actions. The Action screen displays.

  2. Select the relevant custom action. The General screen displays.

  3. Select Request. The Request screen displays.

  4. In the Path field, remove the action param you want to encode.

  5. With the cursor in the correct location to insert the param in the Path field, select the insert field button, insert_field.png, then select the Formula Fields button, formula_calculator.png. The formula field dropdown displays.

  6. In the search field, enter "Encode" and select Encode URL. The Create formula window displays.

  7. In the Formula Editor, select Field. The Field dropdown displays.

  8. Select the Insert Param button, formula_preset.png, then select the action param, Customer Email.

  9. When finished, select Done. The Create formula window closes.


    The Request screen displays, including your newly-updated endpoint path:


    Now, the Encode URL formula automatically encodes the paramater to ensure only valid characters are passed in to the application's API. Follow this same process for any other params that you might use as part of an API request or in a URL in general.