Design & Development / Professional Life

SharePoint Workflows: Using Variables to Resolve User Names

By default, SharePoint 2007 workflows do not resolve Windows domain accounts into first and last name structures – only domain\username. This can be frustrating to end users who do not know who the user name is referring to, depending on how your company structures user names. This blog post explains how to translate cryptic user names into a real person’s name when using workflows in SharePoint by setting variables.

Please note: The steps below are instructions for my particular SharePoint environment at work. Although the steps are general, they may or may not pertain to your environment specifically as stated below. If that is the case, just remember Google is your friend. :)

Here we go!

  1. Open SharePoint Designer
    1. Select New > New Workflow
      1. Name workflow
      2. Attach workflow to list
      3. Select workflow start options
  2. Add New Variable
    1. Click Variables (bottom of screen)
      1. Click Add
        1. Select type
        2. Enter variable name
      2. *Notes
        Unless comparing two different types of data, the default value String will work for most variable types
  3. Set Variable in Workflow
    1. Add new workflow step
      1. Enter a name for the workflow step
      2. Select Actions > Lookup User Site Property
        1. Enter “Title” in the [Lookup this user property] field
        2. In the second this user property field, click the function icon
          1. Select Current Item Select appropriate field
          2. Click OK
        3. In the [Store in Variable: variable#] field, select the appropriate variable from drop down menu
      3. *Notes*
        1. This step must be the first step in the workflow
        2. You may add this action more than once in the same workflow step
        3. Actions can run sequentially
  4. Use Variable in Workflow: Send Email
    1. Add new workflow step
      1. Select Action > Send Email
        1. Within the text area, click Add Lookup to Body
        2. Change Source to Workflow Data
        3. Select appropriate variable in Field
        4. Click OK
About these ads

5 thoughts on “SharePoint Workflows: Using Variables to Resolve User Names

  1. Thanks, Nicely done. Never having seen that “Title” field before, I asked one of my colleagues how to find these fields. If you have Sharepoint CentralAdministration permissions, you can find them under “Shared Services Administration : SharedServicesX” (“X”=your Shared Services #), “Manage Policy”, and “User Profile Properties”. Take care.

  2. Hello – I am having trouble with the 3rd step in your instructions, the “Lookup User Site Property” action is not available to select from the Actions list in Sharepoint Designer 2007 (even when selecting “More Actions”). Appreciate any help you can give, thanks!

  3. That’s neat … but I’m trying to figure out how to capture the name of the person who manually initiates the workflow. Logic tells me it should be easy, but Google is suggesting it’s not possible. What do you think?

  4. Thanks. I have been using this great info. since 2012. Today, in 2014, I found an issue where, if the AD value I selected contains nothing, the portal returns a “System.NullReferenceException: Object reference not set to an instance of an object.” and the workflow breaks, returning a “Error Occurred” error. The checking of the AD value breaks the workflow. No way to “pre-check” that I can find. (Example: AD phone number has no value.) Any ideas? Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s