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:
Navigate to the data source and, in the data source configuration panel, select Actions. The Action screen displays.
Select the relevant custom action. The General screen displays.
Select Request. The Request screen displays.
In the Path field, remove the action param you want to encode.
With the cursor in the correct location to insert the param in the Path field, select the insert field button, , then select the Formula Fields button, . The formula field dropdown displays.
In the search field, enter "Encode" and select Encode URL. The Create formula window displays.
In the Formula Editor, select Field. The Field dropdown displays.
Select the Insert Param button, , then select the action param, Customer Email.
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.