Nintex Workflow Recording Sales: Part 3 – Making use of Loop N Times


The following content is the next part of a series of posts relating to the an ongoing scenario. The previous posts in this series can be viewed using the links below:

Although this is part of a larger scenario, each post can be suitably viewed separately for those that would like to view this for the general concept.

Scenario overview

In today’s post, we are going to give you an example as to how we can make use of the Loop N Times action in Nintex Workflow for Office 365 relating to our Sales list example.

You may have seen the “Loop N Times” action in Nintex but have yet to make use of it. This action allows you to perform any number of actions a number of times before continuing with the rest of the workflow.

In my workflow, I want this number of loops to be dictated by the user input in a list column.

In my Item Sales list, I have been told that each item sold must be recorded in separate records as opposed to a single record with a quantity higher than 1.

If an item is sold in bulk, for example 10 of the same item, I need to prevent the need for a user to enter 10 new records as this would take unnecessary amount of time.

Instead, I am going to allow the user to enter an item and quantity, but use the quantity value as the number of times the loop is executed, and with each loop, create a new item in the list (one for each item sold).

So if the user enters into a single record that 10 bananas have been sold, the loop will separate this into 10 individual records of 1 banana sold.

Adding and configuring “Loop N Times” action

To do this, I have to add the “Loop N Times” action to my workflow. Within this loop I will be creating a list item on each loop, therefore place the “Create List Item” action within the loop as below.

loop with create

In the configuration for the looping action you can set the repeat count to match the Quantity that the user entered in the list. If you have been following the previous blogs, here you can simply assign the Quantity variable that you have earlier assigned.

loop n times config

Now, the loop will run for the amount of times of the item quantity, and each time will create a new item sale.

Adding and configuring “Create List Item” action

For the configuration of the “Create List Item” action, you can select the target list (I have used the current list), and assign whichever values you see necessary to the new item.

In my case, I have used various examples of how values can be assigned.

As you can see below, I have done the following things:

  • Set the “Item” column value by using the “Advanced Lookup” feature and selecting “Item” column from the “Current Item” using the “List Lookup” option.
  • I then set the “Price” column to equal the value of my previously set Workflow Variable named “Price
  • I used plain text to make sure that the “Qty” column always has the value “1”.

create list item settings

If you want, you can then delete the current item once the loop has completed all of its iterations, just to tidy up the list and make sure this entry is not duplicated. Use the “Delete Item” action for this.

When completed, publish the workflow and try to add an item to the list with a “Qtygreater than 1.

At first you will see the entry as normal:

single item

Once the workflow has ran, the list will then have an entry for each of these:

multi entries

All of that labour time saved! Excellent!

In our next post, we will be using the “Send an email” action to construct a dynamic email based on workflow and list values.

If you would like to know when the next post is published please follow us on twitter / facebook

Leave A Reply

Please enter your comment!
Please enter your name here