How to Reference the Current Item and Loop Item Values with ‘Repeat For Each Item’ in Workflow Conductor

As mentioned in the Bamboo product documentation for Workflow Conductor, the Repeat For Each Item widget executes a sequence of other widgets for each item in a list. The widget can repeat this sequence once for every item in a list, or it can be limited to a specific start and end item and/or a specific list view.  You can drop any combination of widgets into the Repeat For Each Item widget. In this example, we’ll simply be using the Log History widget in the Repeat For Each Item widget in order to create the following workflow.

First, you will need to configure the Repeat Item for Each widget:

  • Configure the repeat settings: Click the button to select the items which will be cycled through in your loop. Please note that if you do not make any selections, the loop will start with the first item in the list and continue in order (by SharePoint ID) to the last item in the list:

If you prefer to limit your workflow to a specific start or end item, select and Conditional Item option and configure a lookup to determine which item in the list be your start or end item. For the purposes of this example, we will leave this set to First Item of List and Last Item of List.

Next, click the Create new variable link next to the variable list. This variable will be used to store the ID of the item that is currently selected in the loop. In this example, all of the item IDs will be used in the Log History widget:

After clicking Create a new variable, a new form will pop up from which you can create your new variable.  After you have created the new variable, click Save Changes to add the new variable to the workflow:

Next, click the Apply button to save the configuration for the Repeat For Each Item widget:

Next, configure the Log History widget to reference the Current Item: Title field (pictured below) by opening the Outcome property, using the Add Lookup button, then selecting Title from the Current Item. Please note that the Current Item refers to the item the workflow was started on. It does NOT refer to the item that the Repeat For Each Item widget is currently on in the loop:

After the above steps have been completed, run the workflow. In our example, you can see that the workflow was started on an item titled “test 03”:

When the workflow runs, it will grab the title of the current item on which the workflow is being run, and populate the Outcome field in a new history log. In this example, the title of the current item is “test 03” and we set out a loop to run from the first item to the last item, so you will see a new history log entry for every item in the list, and they will all have an Outcome value of “test 03”, since that is the value of the title field for the item on which the workflow was started (Current Item).

If we want to get a value from the current loop item rather than the current workflow item, we would need to configure things differently. For example, to get the Title value of every item in the list, here is how the Log History widget would be configured:

Use a field lookup that returns Title by getting the item where the ID of the item is equal to the variable we created earlier to store the current Loop Item ID.

{Variable: repeat}: Variable was created from the Repeat For Each Item widget.

When the workflow runs, it does a lookup for each item it loops through that will get the Title value of that item and write it to the history log.

Consequently, the results will be as follows:

In summary, to reference the item on which the workflow is run, use Current Item. To reference a field value in the loop item, use a field lookup to the current list that gets the right item by matching the Item ID to the Loop Item ID stored in the variable selected in the widget settings.

Questions? Contact us!

SharePoint Online

The cloud parts are functional components that extend your SharePoint Online environment in Microsoft 365.

Supports Classic and Modern sites for SharePoint Online/Microsoft 365

Small Business Pricing and Discounts

SharePoint

Top SharePoint Online Products

Experience greater power and savings by bundling our SharePoint apps and cloud parts.


Calendar Plus


Carousel


Employee Directory Plus


Org Chart Plus


Simple Search


Tabify


Tree View

 

On-Premises Only

These web parts extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of SharePoint Web Parts.

SharePoint 2016, 2019, 2022 – Classic Pages Only

SharePoint

Top On-Premises Only Products

Experience greater power and savings by bundling our SharePoint apps and web parts.


Calendar Plus


Data Viewer


Password Change


Password Expiration


Password Reset

 

Our team of Microsoft 365 Technology Consultants helps you get the most out of your Microsoft technology, we have the best Microsoft 365 talent to streamline your organization.

Consulting to Streamline Your Department

M365 Plus

Managed Services

Microsoft 365

Consulting to Streamline Your Department


Human Resources


Information Technology


Marketing Campaigns


Healthcare


Sales

 

Our Consultants Have What You Need

Federal Contractors