A simple look at objects
Nintex Workflow Cloud allows workflow designers to work with and manipulate data through the lifecycle of a workflow, in addition to providing easy accessibility for primitive data types such as string, integer, and Boolean. If you have designed a form in Nintex Workflow Cloud and used the data collected in your form for your workflow, you will be familiar with those data types in the start event variables.
Recently, Nintex Workflow Cloud introduced a new data type for working with data in your workflows, namely objects. Let’s take a look at the structure of an object, how to access data within an object, and why objects offer greater flexibility.
Before we look at an object in Nintex Workflow Cloud, peering into the structure of an object will assist in understanding how to navigate an object to parse the data you wish to capture. In this example, we will build a standard Person object. A person will have attributes associated with them, and we need a way to capture and maintain that information. We will start by making the Person object:
Person = new Object;
Currently, we do not have any attributes associated with the Person object, so it just looks like this: {}.
We do want to add a couple of attributes, such as first name, last name, and email. We know that all three values will be string values associated with the attributes, so we can build the Person object as follows:
Now, we can create a Person object, to capture information:
Now that we have an object, how do we locate the required value? For example, I need to capture the email of this Person object so that I can email the individual. In this example, I would use Person.email. The result would be john.doe@nintex.com.
Objects in Nintex Workflow Cloud: Introduction
To get a value it would be written as Object.attribute. In this case, Object is the name of the object and attribute is the name of the attribute. So why is this better than having a variable called email, and john.doe@nintex.com as the variable value? Well, let’s imagine that we make a query against a list, and the return value is collection of objects. How does that look?
Imagine if an array of objects were returned, such as a collection of students attending a class. That means if you needed to have a variable assigned for each email address, the approach of having one string variable called ‘email’ would not meet our requirements. Especially when you have to capture a specific object instance of the returned object array. When would you come across this issue? When making a Web Service GET request or when using SharePoint Online connectors in SharePoint Online.
You will also see objects as the data type for Start Event variables in Nintex Forms within Nintex Workflow Cloud:
Now you have greater granularity in the form and workflow variables you use within your workflows. Also, object support is now available for custom connectors! This means you will be able to collect and write back complex objects in the custom connector you build for use in Nintex Workflow Cloud. For an example of a custom connector using complex objects, look at the Seismic Integration connector which can be found on the Nintex Solution Accelerator Gallery.
For a deeper dive into the construction of the Seismic Integration custom connector and how complex objects were utilized to provide robust functionality within this one connector, please read the Earth Shaking New Object Functionality in Xtensions® blog post on Nintex Community.
Interested in trying out Nintex Workflow Cloud for yourself? Click here to request a free trial today.