Append to Flow Variables flow logic
Summarize
Summary of Append to Flow Variables flow logic
The Append to Flow Variables flow logic in ServiceNow enables you to append one or more object values to an existing array of objects flow variable within a flow. This functionality is essential for dynamically building or updating arrays of complex objects using flow data, allowing flows to manipulate collections of structured data efficiently.
Show less
Inputs and Usage
- Name: Specifies the array of objects flow variable to which values will be appended. This input only lists flow variables of type Array.Object.
- Data: Accepts an object, an array of objects, or a flow variable data pill containing the values to append. The schema of any existing object data pill must match the schema of the target flow variable to ensure compatibility.
Users can provide dynamic values by dragging data pills from the Data panel or selecting them via the pill picker.
Outputs
This flow logic does not produce standalone outputs but modifies the specified array of objects flow variable by appending new object values to it.
General Guidelines
- Create and use appropriate flow variables: Define an array of objects flow variable with a schema matching the objects you want to append. You can create this array within the flow or pass it as a subflow input.
- Schema consistency: Ensure that the object schema of the data you append matches the schema of the array of objects flow variable. Mismatched schemas will prevent successful appending.
- Building arrays of objects: For example, to collect incident records with a specific category (e.g., Network), you can extract relevant properties like Sys ID and short description into objects, append them to the array flow variable, and then output the complete array as a subflow result.
Practical Application for ServiceNow Customers
This flow logic empowers you to manage collections of objects dynamically within your flows, which is useful for aggregating records, building complex data structures, or preparing data for further processing. It integrates smoothly with other flow logic components such as subflows, decision logic, and data assignments, enabling modular and maintainable flow designs.
Append a value to one or more array of objects flow variables. Use flow data to generate values.
Inputs
Provide a value for each input that your flow logic needs. To add dynamic values, you can also drag pills from the Data panel or select them from the pill picker.
- Name
- Data type: Flow Variable
Name of the array of objects flow variable that you want to append object values into. The drop down list only shows flow variables that are of type Array.Object.
- Data
- Data type: Array of Objects, Object, or flow variable data pill
Object or objects data pill containing the values that you want to append. If you use an existing object data pill, then the object schema must match that used by the flow variable. Alternatively, you can expand the schema of the flow variable and provide a flow variable data pill for each object property.
Outputs
This flow logic produces no outputs of its own, but it does add object values to the Array.Object flow variable that you selected from the Data pane.
General guidelines
Use these general guidelines when using the Append to Flow Variables flow logic.
- Create inputs or flow variables to provide data values
- If you have an existing array of objects, you can use this array of objects as a subflow input. Alternatively, you can use one or more flow variables to create an array of objects within your flow. For example, you can save record values in a flow variable and then append the variables values to the objects within the array of objects.
- Define an array of objects flow variable
- This flow logic depends on there being an array of objects flow variable. You must create an array of objects flow variable and that has the object schema structure that you want to update.
- Ensure that a data pill object schema matches a flow variable object schema
- If you configure the Data input to use an existing object data pill, then the object schema must match that used by the flow variable. The flow logic can not append values to a flow variable object that has a different object schema.
Build an array of incident objects
In this example, a subflow looks up incidents where the category is Network. For each network incident, the subflow sets the value of the incident Sys ID and incident short description in a subflow variable. The subflow then appends these values to the array of objects subflow variable. The subflow then provides the array of objects as a subflow output.
The subflow execution details show that the output value of the incidents array of objects.