Define workflow variables in SharePoint Designer 2010

Learn which two methods you can use in SharePoint Designer 2010 to define or create workflow variables to enable storing and retrieving data that can be used later in a workflow.

ADVERTISEMENTS

You can see a workflow variable as a storage container inside a SharePoint Designer workflow.

Workflow variables in SharePoint Designer allow you to temporarily store data or the result of a calculation at one stage in the workflow so that you can retrieve and use this information later on elsewhere in the workflow.

There are two ways to create workflow variables in SharePoint Designer 2010.
You can:

  1. Define a workflow variable through Workflow Settings > Variables > Local Variables.
  2. Create a workflow variable through the Output clause of SharePoint Designer workflow actions that allow you to output results to a variable.

To create a SharePoint Designer 2010 workflow variable through Local Variables on the ribbon:

  1. In SharePoint Designer, create a new workflow.
  2. On the Workflow Settings tab under the Variables group, click Local Variables.

    Local Variables button on the ribbon in SharePoint Designer 2010

    Figure 1. Local Variables button on the ribbon in SharePoint Designer 2010.

  3. On the Workflow Local Variables dialog box, click Add.
  4. On the Edit Variable dialog box, type a Name for the variable, select a Type (Boolean, Date/Time, Integer, List Item Id, Number, String), and click OK.

    Creating a SharePoint Designer workflow variable

    Figure 2. Creating a SharePoint Designer workflow variable.

  5. On the Workflow Local Variables dialog box, click OK.

Now you can use the workflow variable to store data, for example by using the Set Workflow Variable SharePoint Designer workflow action, and then later retrieve it, for example by performing a lookup in the Workflow Variables and Parameters data source on a Lookup dialog box.

To create a SharePoint Designer 2010 workflow variable through the Output clause:

  1. In SharePoint Designer, create a new workflow.
  2. Add a SharePoint Designer workflow action that supports the Output clause. The following SharePoint Designer workflow actions support storing data in variables:
  3. Click on the text behind Output to and either select to Create a new variable or select an existing variable from the drop-down menu.

    Output clause on a Find Interval Between Dates workflow action in SPD

    Figure 3. Output clause on a Find Interval Between Dates workflow action in SPD.

    Note that for an existing variable to appear in the Output to list of a workflow action, its type must be compatible with the type of data that the workflow action returns.

    In the example above, the Find Interval Between Dates SharePoint Designer 2010 workflow action returns a number, so if you want to first create a variable using the first method described in this article, and then use that workflow variable in the workflow action, you must create a variable of type Number.

Related Articles

ADVERTISEMENTS