Payload Builder step
Summarize
Summary of Payload Builder step
The Payload Builder step enables action designers in Workflow Studio to create dynamic JSON and XML payloads using customizable name-value pairs. It supports the inclusion of dynamic data through data pills and allows for flexible payload formatting options. This step is designed to simplify payload creation within custom actions for users with theactiondesignerrole.
Show less
Note: The Payload Builder step for JSON is deprecated and replaced by the JSON Builder step.
Key Features
- Name-Value Pairs: Allows adding multiple key-value pairs where keys become JSON keys or XML elements. Dynamic data can be inserted using data pills.
- Omit if Empty: Option to exclude any name-value pair if its value is empty or null, enhancing payload cleanliness.
- Output Format Selection: Choose between JSON or XML formatting for the payload.
- XML Namespace: When outputting XML, you can specify a namespace prefix to apply to each XML element for better integration with XML schemas.
- Include Outer Structure: Option to wrap the payload in a top-level container element or object, depending on the format (e.g., curly braces for JSON or a parent XML element).
- Send Empty Structure: Controls whether an empty but valid JSON or XML structure is sent when all payload values are empty, or if the payload is completely omitted.
- Parent Node (XML only): Specifies the name of the container XML element surrounding the name-value pairs when outer structure inclusion is enabled.
- Preview: Provides a read-only view of the payload generated by the step for verification purposes.
- Action Error Evaluation: Configurable behavior on step failure, allowing continuation or triggering of error handling in workflows.
Practical Benefits for ServiceNow Customers
- Facilitates easy construction of dynamic payloads for integrations and API calls without manual JSON/XML coding.
- Offers flexibility to handle empty values gracefully, preventing invalid payloads from causing errors downstream.
- Supports both JSON and XML payloads, catering to various integration requirements.
- Enables namespace and parent node customization for XML, supporting complex XML schema needs.
- Improves workflow reliability by allowing controlled error handling when payload creation fails.
Enable action designers to easily create name-value pairs in JSON and XML payloads using dynamic data.
Roles and availability
Fields
| Fields | Description |
|---|---|
| Name Value Pairs | The name-value pairs to include in the payload. Click the plus icon to add name-value pairs. Drag data pills into either field to produce dynamic payloads. The Name becomes a key in JSON and an element in XML.
For example, suppose you create this name-value pair.
When the system formats the name-value pair as
JSON:
When the system formats the name-value pair as XML: |
| Omit if empty | The option to exclude a name-value pair if the value is empty or
null. Note: This field is only visible after clicking the down arrow to display
advanced options. |
| Output Format | The payload file format.
|
| Namespace | The XML namespace to apply to each element. For example, when the namespace
is set to
incident:
Note: This
field is only visible when the Output Format is set to
XML. |
| Include Outer Structure | The option to include or exclude a top level container appropriate to the output format. When the Output Format is JSON, curly braces contain the name-value pairs. When the Output Format is XML, a specified XML element contains the name-value pairs. For example, when the system formats the name-value pair as JSON:
When the system formats the name-value pair as XML: |
| Send Empty Structure | The option to send valid JSON or XML structures when the payload is empty. Enable this option to include JSON or XML structural text in the payload. For example, when the system formats an empty structure as
JSON:
When the system formats an empty structure as XML:
Disable this option to produce an empty payload. Empty payloads can occur when you select the Omit if empty option for every name-value pair, and all name-value pairs in the payload produce empty values. |
| Parent Node | The name of the XML element that contains the name-value pairs. The default
parent node element is xml.Note: This field is only visible when
the Output Format is set to XML
and the option to Include Outer Structure is
enabled. |
| Preview | The read-only payload the step produces. |
Action error evaluation
- If this step fails
- Data type: Choice
Option to continue running the next step or go to error evaluation. To use the step status code or message for a custom action error condition, see Action error evaluation.