This is the first post of the series related to SPD 2013 Workflows. During this series we will create and improve a solution based on SPD 2013 Workflows.
As you most likely know, SP2013 has possibility to use the new workflow system (based on Workflow Manager). However, it is impossible to use InfoPath task forms with it. In addition, API which we could use for communication with 2010 Workflows doesn’t work for 2013 ones. In this series of posts I want to show you how to create SP2013 workflow, customize its task forms and implement some typical features like reassigning of the task or Request Changes/Task another person with supplying additional information behaviors.
This series will consist of 3 parts:
1. Creating extremely simple workflow with default task form. This part is for very beginners only and if you know how to create simple SPD workflow you can skip this part without any risks to not to understand the following parts, but if you are a beginner, it is the right place to start!
2. Implementing custom ASP.Net task form and embeding it to a workflow. In this part you can find information how to create a custom task form. Also in this part you’ll find the answer on the question “How to complete a task or change an assignee if old SP2010 methods doesn’t work anymore?”.
3. Tips and hints of custom ASP.Net task forms creation. In this part you can find how to implement reusable parts of task forms, how to force SP controls work as expected after changing context, how to create analogue of the Request Changes behavior which was built-in in SP2010, but should be implemented yourself in SP2013 and some other techniques!
This is the first post from this series and here we will create a very simple workflow with default task form, just to understand how to start to create SPD 2013 workflows. As it was mentioned before, if you know how to create simple SPD workflow, you can skip this part and go to the second part right now. If you have never created any SPD workflows and want to understand where to start, you are in the right place! Let’s get started!
- Step 1. Create a list and items to run a workflow on;
- Step 2. Create SharePoint 2013 workflow with the default task form;
- Step 3. Check whether workflow works;
Step 1. Create a list and items to run a workflow on.
Let’s assume we want to create a workflow using which a user could request office supplies. For that we create the Office supplies requests list.
1. Open your site collection in SPD2013;
2. Create a new list “Office supplies requests”. For that select “Lists and Libraries”, press “Custom List”, enter list name and description and press OK.
4. Press “Add New Column” and click on “Single Line of Text”
5. Type the name of the new column (“Department”) and click on the Save icon (or press Ctrl-S).
Result of the first step: Now you should be able to see “Office supplies requests” list using your browser:
Step 2. Create SharePoint 2013 workflow with the default task form.
1. Open your site collection, select Workflows and press the List Workflow button. Select “Office supplies requests” list we have just created.
2. Type the name and the description of Workflow, select SharePoint 2013 Workflow Platform Type and press OK button.
3. Set cursor in the Stage 1 section and start typing “Task” then press Enter. In choices window select “Start a task process”. After that press “these users” link.
4. Fill in task process fields (Participants, title and description). In description area you can add Title of the supplies and Department by pressing “Open editor for body” and do the following steps:
5. After filling in all fields the form should look like this:
6. Press OK button and fill in “Transition to stage” section of the workflow designer. For that set cursor on this section and type “Go”, then press Enter and change stage to “End of Workflow”.
7. Press “Check for Errors” button to be sure that you have made all correctly and “Publish” button after this.
Result of the second step: You have created and published very simple workflow and it is ready to use.
Step 3. Check whether workflow works.
1. Go to Office suppliers requests list. There you could see new field “Request supplies” in this field later you will see current stage of the Request supplies workflow.
Press “new item” link, fill in Title and Department fields and press Save.
2. Press “…” \ Workflows to see the list of available workflows for this item.
3. You should see the “Request supplies” workflow which we have recently created. Click on it to start.
4. After several seconds (press F5 to update page) you should see that the value of the Request supplies field is changed to “Stage 1”. It means that workflow has started and now is on the “Stage 1” (you could remember that this is exactly the name of the first stage in workflow designer, if you want you can change it later in workflow designer). Click on the “Stage 1” link to see the status of the workflow and tasks related to it.
5. Here you can see that there is a task “Provide office supplies” which was created by workflow. Point the mouse to task name and press the arrow which should appear on the right. After that select “Edit Item” to start editing the task.
6. After that you should see task details which have several fields and buttons. You can complete this task by pressing Approved or Rejected button.
7. After that this simple workflow should complete. You can see it in its Internal Status.
Result of the second step: We have tested the workflow and could see that SharePoint created default task form for us. This form has several fields and buttons, using which we could change task state and complete it.
We have just created and tested extremely simple SPD 2013 workflow, but this should give you understanding how it works. Most likely, even now you have several ideas what should you do to develop more advanced WFs. As you probably understood, you can add new fields to your list and add different built-in actions and conditions to your workflow. Full list of them you can find here. Even using only built-in actions and conditions you can implement rather complex WFs very easily.
However, most likely, when you create necessary for you sequence of tasks, you would like to improve quality of task forms. SP 2013 workflows allow to do it using custom ASP.Net forms. Using this technology you can create really beautiful and powerful custom task forms and embed them in your WF. If you want to know how to achieve it, welcome to the second part of these series! 🙂