Creating Unique Identifiers in SharePoint 2013 Lists via Workflow

Screen Shot 2016-03-31 at 6.27.24 PM.png

Throughout many of our customer projects there have been multiple requests to deliver a unique identifier for lists and libraries.  These projects have been for internal help desk solutions, Goods and Services Request Centers, Case Management solutions, etc.  I’d like to share one of many methods that we’ve used to deliver such capabilities with success.

 

The Scenario

For the purposes of this walkthrough let’s assume that we’re working on a Request list that takes various types of requests from employees and allows them to input some very basic information about their request.  Our goal is to allow members of our company to submit requests to a centralized repository and then to have their requests categorized and uniquely identifiable by way of the Title of the request.  We’re going to implement this solution by developing a SharePoint 2013 workflow that updates the Task Name field on item creation with a concatenation of data from our item.  Specifically, we’ll concatenate the Request Type, Created date, and the listID number for our item.  The end result should look something like this example: [Purchase] - 3/31/2016 - 2 .

The Prep

To prep our Request list for the workflow and to provide a very basic level of demonstration content, we’ve configured our list with the following specs:

  1. Create a Task list titled Requests
  2. Add Choice column titled Request Type
    • Choices are: Purchase, Support and Leave
  3. Edit the default view to Group By our field Request Type

Optional

I like to hide the Task Name field from my forms so that users don’t feel that they can change the name of our list items. Instead, our workflow will generate this for us after it completes.  Even though I hide this from our forms, the field is still easily accessible to list views and at the top of the forms as the title.

  1.  Go to your list settings > Advanced Settings and Allow Management of Content Types
  2. Then back on your list settings page, click on the Task content type and then on the Task Name column.
  3. Set the column to Hidden and click ok.

The Nitty Gritty

First thing we’ll do is open up SharePoint Designer 2013 and connect to our site that contains or will contain the Requests list we’ll be working with.  I’ve gone ahead and created a site called Workflow Demo Site and created a list called Requests based on the Task list template.

Once you’ve connected Designer to your site, open up the list that you’ll be working in.  i.e. Requests list.

Screen Shot 2016-03-31 at 6.33.45 PM.png

CREATE THE WORKFLOW

Create a new List Workflow associated with the Requests list.

The workflow designer will open up and you can begin entering the steps you want your workflow to walk through.

    1. Let’s begin with renaming the “Stage” of your workflow that may be something more meaninful than “Stage 1”.  I’ve renamed the stage to Create Unique ID.
      Screen Shot 2016-03-31 at 10.14.56 PM.pngStages can help you identify what stage of your workflow an item currently resides in if you have many.
    2. Next let’s establish some variables for our workflow.  In the ribbon you’ll find a button labeled Local Variables.  Add the following
      1. Name: Date
        Type: Date/Time
      2. Name: SPID
        Type: Number

Screen Shot 2016-03-31 at 11.15.46 PM.png

    1.  Then in the first row of your workflow you can insert an action to Set Workflow Variable.  Set Workflow Variable for Date and SPID.  Set:
      1. Date = Current Item : Created
      2. SPID =  Current Item : ID

Screen Shot 2016-03-31 at 6.37.13 PM Edited.png

  1. Once you’ve set the variables, on the next line of your workflow, insert an action to Update List Item.
  2. Click on the highlighted “this list” text in your new workflow step and in the modal, make sure that Current Item is selected in the dropdown and click Add.
  3. In the Value Assignment dropdown you can select the field that you would like to make the container for your unique identifier.  We’re using Task Name as the field to update.
  4. Then in the To This Value field, click the ellipsis and we’ll begin creating our concatenation string of item data.
  5. In the modal window (String Builder) we’ll click the Add or Change Lookup button and select Current Item : Request Type.
  6. Then we’ll add our variables as we created in the beginning.  Click on Add or Change Lookup again and this time change the Data Source dropdown to the Workflow Variables and Parameters choice.  The Field from source dropdown below will now be populated with your two variables created in step two.  Go ahead and add both of your variables to the String Builder window.  I selected Short Date for the format of my Date Variable and String for the format type of my SPID variable.
    Screen Shot 2016-03-31 at 6.38.21 PM.pngWithin the String Builder window you can type in any formatting you may want to build your unique identifier with.  For instance, I’ve wrapped the Request Type with brackets such that in my list view, the Request Type is easily identifiable.  You’ll notice in the example, i’ve also formatted the space between each field being concatenated with dashes to add some seperation of data visually.
  7. In the Transition to stage section of your first workflow stage, go ahead and insert an action to Go To A Stage.
  8. Now click outside the first stage box and you can add a new stage from the ribbon.  Give your new stage a name.  i.e. Complete.
  9. For the Create Unique ID stage, in the transition dropdown, choose to go to a stage: Complete.
  10. In the last stage (Complete), I’ve only added one action and that was to Log a message.  I’ve instructed it to log the message: “Updated Task Name: and inserted the Task Name field.This allows us to review workflow history and identify possible breaking points if things go wrong.
  11. Finally, add the End Workflow to the transition to stage dropdown for our Complete stage.
  12. SAVE the workflow!
Pheww!  Much easier to do than type, I promise.  We have created all of the necessary steps and now we just need to ensure that the settings for the workflow trigger are set correctly.
  1. Go back to the Workflow Details tab for our newly created workflow and ensure that the box is checked to Start workflow automatically when an item is created.
    Screen Shot 2016-03-31 at 6.34.38 PM.png
  2. Save… and Publish.

The Test

Let’s add a few sample items to our list and test the workflow.  Add a few items, one for each Request Type so that you can verify your view is working to group the requests by type and your Unique ID (Task Name) includes your Request Type in the resultant concatenated string.

 

Conclusion

We’ve built a unique identifier for SharePoint list items by way of a SharePoint Designer 2013 workflow.  Like I mentioned before, there a lot of methods for accomplishing this same functionality but I believe that working through this solution, has in my experience in the past, opened the eyes of young SharePoint designers to the potential that workflows and the functionality within designer contain.  Working with the workflow designer, setting variables, using workflow context and actions can quickly take a budding SharePoint user to Power user.  We hope that you find some good information in this post and look forward to any questions you may have regarding this or any other SharePoint features and solutions.

SharePoint

Applications

SharePoint apps are stand-alone applications that perform specific tasks on a SharePoint site. Apps can perform functions such as managing a discussion board or knowledge base, performing project management or time tracking tasks, or doing other workflow operations.

SharePoint

Product Suites

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


Essentials


Essentials Plus


Bamboo Premier


Project Management Suite


Knowledge Management Suite


External User Manager


SharePoint

Web Parts

Extend SharePoint beyond its out-of-the-box capabilities by tailoring it to your requirements with Bamboo Solution’s growing portfolio of Web Parts. Web Parts are the building blocks of pages on a SharePoint site that can be used to customize the user interface and content of a site page. 

SharePoint

Product Suites

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


Essentials


Essentials Plus


Bamboo Premier


Project Management Suite


Knowledge Management Suite


External User Manager


Office 365

Cloud Parts

Cloud Parts are functional components that extend your SharePoint environment whether it’s hosted, on-premises, or part of Microsoft Office 365. More than mere ports of existing software to the cloud, our Cloud Parts have been built from the ground up to take advantage of the best that the cloud has to offer.

SharePoint

Product Suites

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


Cloud Parts Suite for O365/SP Onl.


Featured Services

SharePoint Health Check

A SharePoint Health Check will identify the causes of issues and risks associated with your specific environment, and is custom tailored to provide you with the best recommendations to optimize your SharePoint environment.

SQL Health Check

Document recommendations relating to performance, stability, availability, or a specific focus you request of your SQL Server database instances.

My SharePointXperts

The truth is that each SharePoint skill may not be a full time job for many organizations, and it is nearly impossible for one person to do everything you need – so augment your team with SharePointXperts; providing the skill sets you need when you need them!