Create an Inventory Workflow in SharePoint

Windows SharePoint Server 2007 Logo

Recently I had the need to create a SharePoint list that acts as a maintenance work order.  This maintenance work order refers to several lists on the site, equipment, mechanic and inventory.  When a part is used in the work order, we needed it to automatically adjust the inventory quantity in the Inventory list.  While researching into the best way to accomplish this, I read an excellent tutorial from Charles Lee on how to create custom workflows in SharePoint services 3.0. His tutorial is found on simple-talk’s website.

To summarize his tutorial, these are the steps I performed to create a workflow that automatically adjusts inventory quantities in a different list than the one being worked in.

In order to create the workflow, you will need Microsoft SharePoint Designer.  SharePoint Designer is available as a free download at Microsoft.

  • Open SharePoint Designer and connect to your SharePoint Site.
  • In the Menu Bar click File, New, Workflow
  • Type in a descriptive name for your workflow.
  • Select your workflow List.  My list was Maintenance Log.
  • Select your workflow start options.  I selected all three.
  • Click the Next button.
  • If you choose, type in a descriptive Step Name.
  • In this workflow using the Conditions button was unnecessary.
  • Click the Actions button, select Select Workflow VariableIf you don’t see Select Workflow Variable, you may need click More Actions.
    • Click on workflow variable.  It should be to the right of the Actions button. Select Create a new variable.
    • In the name field, type a name of your choice.  I used InventoryQTY.
    • In the type field, select Number. Click OK.
    • Click value (next to the variable you just created) then click the fxbutton.
      • Keep Source choice as Current Item.
      • In the Field dropdown select field in your list that you want to use.  This is the column in your list that has the inventory quantity.  For me it is Part Quantity.
      • Click OK.
  • Next you will need to add an additional Action.  Click the Actions button and choose Do Calculation.
  • Click value (to the right of the Actions button) and click the fx button.
    • Define Workflow Lookup
      • In the Source: field select the list where your part inventory resides.  My list is Inventory.
      • In the Field: select the column in your list that contains the quantity of your inventory.  My column is Quantity.
      • The Find the List Item section lets you set which fields on both of your lists the workflow should compare.  choose the following:
      • Field: Column of your Inventory list that you want to use to sync your information.  For my workflow I used Inventory:Part Number.
      • Value: Click the fx button.
        • Source: Select Current Item
        • Field: The column in your current list that links to the Field in the previous step.  My field is Part Number. (This column in in my Maintenance Log list.) Click OK.
      • Click OK.
      • You may receive a warning message stating that it isn’t guaranteed to return a single value.  Click Yes.  For this workflow it’s ok.
    • Click plus, select minus
    • Click value.  Click the fx button.
      • Source: Select Workflow Data
      • Field: Select the variable you created in the first Action.  Mine is Variable: InventoryQTY
      • Click OK.
    • Click the Actions button.  Select Update List Item.
    • Click this list
      • List: Select the list you wish to update.  My list is Inventory.
      • Click the Add button
        • Set this field: Select your field you would like updated. My field is Quantity.
        • To this value: Click the fx button.
          • Source: Current Item
          • Field: Select the field with your quantity in the current list.
          • Click OK.
        • Click OK.
  • In the Find the List Item section select the following.  NOTE:  These selections should be the same as the selections you made in the Define Workflow lookup section.
    • Field: Select field.  My choice was Inventory: Part Number
    • Value: Click the fx button.
      • Source: Select Current Item
      • Field: The column in your current list that links to the Field in the previous step.  My field is Part Number.
      • Click OK.
    • Click OK.
    • Once again you may see a warning message about not guaranteed to return a single value.  Click Yes.
    • Click Finish.

    Once you click Finish, your workflow will link up to your SharePoint List. The last thing to do is test.  I had to troubleshoot and test a few times before I got the sequence correct.

Leave a Reply

Your email address will not be published. Required fields are marked *


Subscribe without commenting