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.
3. Select list that you have just created and press “Edit Columns” button.
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! 🙂
PS: For more information about workflows development in SP2013 you can watch this video and take a look at articles here.
I am just trying to implement task forms for a SharePoint 2013 workflow. Looking forward to the second installement of your serie.
Thank you for starting this topic!
Thank you for your comment. I hope today I will write the second part of the serie. Stay tuned! 🙂
Pingback: Creating SPD 2013 Workflows. Part 2/3: implementing custom ASP.Net task form | SharePoint 2013 Developer's Blog
The article is great and I appreciate it . Thanks Very much for the same.
When I do the same on office 365 I get the on executing the following command
“7. Press “Check for Errors” button to be sure that you have made all correctly and “Publish” button after this.
Get the following error
Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
Cannot set unknown member ‘CompositeTask.RelatedContentLinkListItemIntegerId’. HTTP headers received from the server – ActivityId: f5f69e32-218d-4679-b445-6d4203e6ce7a. NodeId: . Scope: . Client ActivityId : 611d199c-8179-209b-200c-d6206469569b. —> System.Net.WebException: The remote server returned an error: (400) Bad Request.
Whenever I use the “Start a task Process” activity I am getting the error
It is a very frequent error currently. If it was on your on-premise farm you would be able to fix it, by re-registering Workflow Manager as it shown in my post: Solution: Errors were found when compiling the workflow. The workflow files were saved but cannot be run. (Cannot set unknown member). However, as you can see it in Office 365 then most likely you have to write a message to the Office 365 support with the description of this error message and probably you can include the shown above link to the email to help them to fix the issue promptly.
This is a good start. Thanks for this tutorial. I am having a difficulty in transitioning from sharepoint server 2010 to sharepoint 2013 online.
Hi Ching. Thank you for your feedback. What kind of difficulty do you have? If you could describe it in more detail, I would try to help you.
Hi I (very beginner) got the following error after followed your steps.
RequestorId: debe6750-b9ff-1c65-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentException: AssignedTo at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity Throw If Sequence Microsoft.SharePoint.WorkflowServices.Activities.OperatingWebContextScope Microsoft.SharePoint.WorkflowServices.Activities.SingleTask Sequence DynamicActivity Subroutine If Serial Tasks If Sequence
Great Article, Thanks!
My organization is using Sharepoint 2013 standard edition. I was wondering if I could use sharePoint 2010 workflows in Sharepoint designer 2013 to achieve this same feat above.
If you want just create a simple workflow then the answer is Yes. You can use a similar approach.
If you ask about the second part of this article (custom ASP.NET form) then you can do it as well with some changes.
Step 1 will be the same,
in step 2 you need to create a custom content type which uses your form from step 1 and make your task use it. This article can help you in that: How to: Implement a SharePoint Workflow with ASP.NET Forms
in step 3 you will probably have to rework “void CompleteCurrentTask(string outcome)” method to make it use SPWorkflowTask.AlterTask method.
The others should be the same. Please, let us know if it works for you.
Thanks a lot for the effort and the article
I am getting below error message…
RequestorId: e948b96b-77ab-d56e-e414-512061490b18. Details: System.ArgumentException: ContentTypeId at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
The WF is designed in SPD2013 and it has below steps..
1. Send email to sharepoint group member.
2. Start WF task with same group.
3. Add item to another list based on WF Outcome variable value.
4. End WF.
The WF task list having custom content type which has site column of type task outcome.
I have single server stand alone setup, everything on one server. Setting done for SMTP server on Central Admin out going mail and I am receiving the mail.
User ID used to to login to server is a member of Farm admin and also has Site Collection Admin rights. The WorkFlow service is running using different service account.
Any direction to get the exact error would be great help! Many thanks in advance.
I have back restore one site , and I am trying to create 2013 designer workflow for sharepoint list. As they are creating without any error but none of them are associating with any of list.I mean there is no associating of sharepoint list designer workflow.
Please help me.
It was helpful article for intial kick start.
Hello, great article, I have an issue, I created one workflow that contain many tasks for differents areas when I executed the workflow with the user that created the workflow, the tasks and workflow working fine, but when run the workflow with different user the workflow not working only show me the first task and not continues, can you help me
Great article, took me a while, but I got it, thanks 🙂