It is ServiceNow new release season! With the New York release in Early Access, we will cover some of the features newly available to application developers. In this post, I will cover more of the new features and enhancements in Flow Designer. Visit Part 1 of New York: Flow Designer if you missed it.
Complex data objects are now available to be created in your flows and actions! A complex object is a collection of structured data. The newly created object will interact with the same as any other created data pill object. The visual representation will show the hierarchy of your structure. Each data element in the object has its data type and position. Each object can be manipulated individually.
You can see in the above image an example of a simple, complex object. It starts with the type object or array. Under the top-level object each element can be a simple or complex object. In the table below you will find all the supported object types or in Docs. For the Array.* Types all the top-level children will be of the same array type object. In our example, this is the Array.Object for the multiple possible addresses for the same user. There will be at least one address_child and can be many.
So why should I start using these, one might ask! Great question. One benefit is less noise in your data pane. Since these are hierarchical type objects, they collapse nicely and can be used just the same as reference field type objects. Opens up more methods to create and organize your data over the payload builder, which was limited to one tier of objects. Less scripting is needed to craft the data structure an integration needs. You are facilitating moving arbitrary yet structured data between flows, subflows, and integration.
Complex Data Templates
With the ability to craft a complex data object also comes the ability to save that configuration as a template. This is especially useful when needing to accept the same structure into an action, and then output the same structure. Saving a template makes it available in all other complex objects. Applying a template creates a unique copy of a template, they do not get updated throughout all the places that template was utilized. Take care to update all the locations you want that new template design to be applied.
Using Complex Data objects
When using the complex data object types, it is useful to be considerate at designing your structure. When possible copy an existing record data structure, to make it easier to utilize. When creating child object types, use a new object for each new type. Try to minimize the depth of the hierarchy as that will make it easier to interact and understand your object for all the consumers.
Scripting into and out of complex data is possible. You can read more about it on the Docs Site. The one thing I will call out specifically when scripting is when dot walking the hierarchy you must use the name of the object, not the label. Another way to create these complex data objects is with the new XML parser step. This new step takes an XML payload and converts it into a complex data object with no scripting or design of the object. The step designs the complex object itself from the schema of the XML payload.
There will be more to come on complex data objects in future posts that focus on IntegrationHub. Check out the Live Code Happy Hour stream to see this new feature and of course, visit the Docs and Community for more on Flow Designer and IntegrationHub.
Share this post