Understanding the Define Workflow Lookup dialog in SharePoint Designer

Learn how the Define Workflow Lookup dialog box in SharePoint Designer 2007 works and how you can avoid your workflow failing to find data when performing a lookup in a SharePoint list or library.

ADVERTISEMENTS

Introduction

You can use the Define Workflow Lookup dialog box in a SharePoint Designer workflow to look up data in:

  1. The current item the workflow is running on.
  2. A variable that is stored within the current workflow.
  3. A SharePoint list or library on the same site the workflow is running on.

The Define Workflow Lookup dialog box displays one or two sections depending on the source in which you want to look up the data.

If you want to look up data in the Current Item or Workflow Data, the dialog box will display only one section where you can select a source and a field to find the data you are looking for. This can be seen as a simple lookup.

The Define Workflow Lookup dialog box in SharePoint Designer when looking up a value in the Current Item

Figure 1. The Define Workflow Lookup dialog box in SharePoint Designer when looking up a value in the Current Item.

If you want to look up data in a SharePoint list or library, the dialog box will display a top section where you can select a source and a field, and a bottom section where you can select an additional field and value to help find the data you are looking for. This can be seen as a more complex lookup.

The Define Workflow Lookup dialog box in SharePoint Designer when looking up a value in a SharePoint list or library on the same site

Figure 2. The Define Workflow Lookup dialog box in SharePoint Designer when looking up a value in a SharePoint list or library on the same site.

Working with the Define Workflow Lookup dialog box

The Define Workflow Lookup dialog box is straightforward to work with once you understand the information it expects you to supply to it.

Taking the more complex example of looking up data in a SharePoint list or library, the top section of the dialog box expects you to supply:

  1. The name of the list in which you want to look up data.
  2. The name of a column of that list where the data is located.

For example, let's assume that you have a list named Calendar and that you want to find the Title of an event, in this case, you want to find an event with the Title "Event 3" as shown in Figure 3 with a green oval around it.

Looking up data in a SharePoint list

Figure 3. Looking for "Event 3" in a SharePoint list named Calendar.

To find "Event 3" in the Calendar SharePoint list, you must select Calendar from the Source drop-down list box and Title from the Field drop-down list box in the top section of the Define Workflow Lookup dialog box.

The first part of the lookup is indicated with yellow in Figure 3 and 4.

Specifying lookup details for a SharePoint list

Figure 4. Specifying lookup details for a SharePoint list.

But to be able to find "Event 3", you not only have to tell the workflow which column to look in (here the Title column), but also which row of data in the Calendar SharePoint list to use.

To do this, you must supply the workflow with the following information in the bottom section of the Define Workflow Lookup dialog box:

  1. The name of the column that contains unique data the workflow can use to search on.
  2. The value of the data in the unique data column that is located on the same row as the data you're looking for.

Following the example of looking up data in the Calendar SharePoint list, you must select ID from the Field drop-down list box and enter a Value of 3 in the second part of the lookup to find the data you are looking for in the SharePoint list.

This second part of the lookup is indicated with orange in Figure 3 and 5.

 Specifying the list item to find in a SharePoint list by using a known ID

Figure 5. Specifying the list item to find in a SharePoint list by using a known ID.

Ensuring data can be found by the workflow

ID and GUID columns in SharePoint lists and libraries are guaranteed to contain unique values, so try using one of these when defining a workflow lookup.

If you want to use any other column you must ensure that the values in that column are unique, otherwise the SharePoint Designer workflow will not be able to find the data you’re looking for.

Related Articles

ADVERTISEMENTS