Skip to main content

Topic

This article explains what object variables are in Nintex Workflow Cloud. It is focused on users upgrading from Nintex for Office 365 and will show how to work with an object that is created by executing the SharePoint Online - Query list action. 

 

Definition

An object variable is basically a container variable that holds a group of variables like text, boolean, integer, collection, or even other objects in a hierarchical structure. The object variable can be accessed by actions that can use the data stored within the child variables.
 

 

Differences

  • In Nintex for Office 365, many actions stored data inside dictionary and collection variables after being executed. In Nintex Workflow Cloud, collection variables are still available, but dictionary variables and their actions will no longer be supported. 
  • Many actions will now store results in object variables as opposed to individual variables such as  dictionaries or collections.
  • Objects are created as result variables by actions when they execute. They may also be created by the workflow Start event and will appear as the Start variable.
  • Objects cannot be manually created or edited in the workflow designer variables panel.
  • When retrieving item data from a SharePoint list, if there is a Person or Group column with the setting to allow groups, the user will not be able to retrieve id, email, or username from the object. The solution is to change the setting on the column in the SharePoint list to only allow people, not groups.

 

Examples

Start event

In this example, the SharePoint Start event will execute when the new list item is added to a list. The Start event - Start variable is an object that contains data about the SharePoint list item that starts the workflow. It has site context that provides information about the list and site where that list item lives. It will also contain the data stored in the list item columns.

 

You can access the contents of the start event object variable in actions throughout your workflow such as Send an Email.

 

Action result variable

In this example, the SharePoint Online - Query a list action, creates an output variable called objMyCarCollection, which contains the results of the query for a list of items in a SharePoint list. It is located in the SharePoint Online variables group and contains a collection variable with all the item IDs that were returned, an integer variable containing the number of items returned, and an object that holds a copy of the first list item returned for easy access.
 

 

This object variable also contains a collection of items, which is a variable with all the list items and their column data that meet the conditions for the query.

 

Instructions


Dictionary Actions

If you originally used dictionary actions in your workflow, those will not upgrade to Nintex Workflow Cloud and will be replaced with placeholder actions, due to dictionary variables and their actions not being supported. The example here shows the Office 365 Query list action storing results in dictionaries, then processing it with For EachQuery XML, and Get an item from a dictionary actions.

 

Actions that use the dictionary will be marked as unconfigured and will need to be updated with actions that process data using the new object variable, or deleted.

 

 

The object variable may improve your workflow design because it requires less steps to access information in many cases. For the workflow example in the image below, the placeholder action titled, Get an item from a dictionary, was removed. It also doesn't require querying XML for data and works directly with the result object variable in a For each action.

 

Retrieve Data from the Output Result Variable

To retrieve and work with list items stored in an output object variable iteratively, use the action, Loop for Each. The following example sets the target collection to loop through the Items collection inside the object variable returned from the SharePoint Online - Query List action. This is a collection of all the items in the SharePoint list and includes all columns from the list for each item with data stored in those columns. 

 

  1. Configure the For Each action's target collection property to use the items collection inside the output object variable from the SharePoint Online - Query a list action. This is found in the SharePoint Online variable group. 
     
     

     

  2. Configure actions within the For Each action grouping to use values from the current item object variable tied to the current iteration in the loop for each action's variable section. In this example, the Set variables action is no longer needed to set a variable that came over from the upgrade. With the object variable containing the SharePoint list items, you can directly access the column values in the Loop for each, current item variable, without having to set other variables. From there the Calculate a value action is changed to use the Value column of the current list item iterated upon in the for each loop in a calculation to total car values in the collection.
     
     


     

  3. You can also access the first item returned from the Query a list action in the output object by working with the First Record variable in actions like Send an Email or Log to instance details. The first record is found under, SharePoint Online > First Item, in the Variables window.
     
     

     

References

Be the first to reply!

Reply