This is the first in a series of blog posts describing how to use workflows together with the Products list in a Product catalog site collection. The purpose of this example is to show you how you can communicate with a list in SharePoint, and by this give you a building block when creating your own workflows.
In this blog post I will show you step-by-step how to create a simple workflow that will read content from a site column, modify the content, and then write the modified content back to the site column. More precisely, I will read the Title of an item, add the words “New Item !!!” to it, and write the modified name back into the Products list for this item. (“Laptop 14.4W” => “New Item !!! Laptop 14.4W”)
Start by opening SPD and mapping it to the Product catalog site collection. From the Sites menu, click Open Site, and then insert the address of the Site Collection.
When entering SPD at a later time, your site collection will be listed under Recent Sites.
Tip: SPD can also be started from within SharePoint. To do this in the Products list, in the LIST ribbon=>Workflow settings=> click the arrow and select “Create a workflow in SharePoint designer” from the list. SPD is then automatically mapped to the correct site collection.
After having mapped SPD to your site collection, the next step is to create a workflow that is associated with the Products list. To do this, click Workflows in the Site objects list to get the right ribbon, then “List workflow”.
Select the appropriate List, in this case “Products”.
Type a suitable name for your workflow and click OK.
You now have an empty workflow, ready to be filled with workflow steps.
The workflow is created declarative; hence no programming is needed when using the SharePoint Designer.
The final workflow will look like this.
Let me guide you through the different steps.
Create your own workflow variable of type String, and do a Lookup for the value in the list column Title in the product catalog. Creating this variable is just to show you that I’m able to fetch data from the product catalog. Since SPD is already mapped to your Site collection, “current item” will present all site columns in the “Field from source” drop down window.
You now have a workflow variable (MyTitle2) containing your new modified title.
This time the field is a lookup for Site column (Current item:Title), and the value is the Workflow Variable and Parameters: MyTitle2.
Line 6: All workflows must end with this Go-to statement.
To keep your workflow, click on Save. The workflow is stored but not activated.
The workflow is now done.
To verify that your workflow is deployed and activated for the Products list do the following:
In SharePoint, in your Product catalog site collection, go to the Products list; activate the LIST ribbon => Workflow settings. The workflow will be listed under SharePoint 2013 workflows.
After starting the workflow you will return to the product catalog UI.
Note: The workflow has completed its task, and we can already see that the title has been modified to “New Item !!! Adventure….” As planned.
If you need to start the workflow automatically there are options for this as well.