Pages

Thursday, June 26, 2014

Create custom outcome options in workflow tasks for SharePoint 2013 workflow

Introduction

I was assigned to a project where I need to come up with workflow as a part of the module. For the first time I’m developing SharePoint workflows and I may get a chance to share some of the knowledge I will be gaining in upcoming days.

Problem Background

I had to assign a workflow task to a user and the task out come should be “Submit” and “Reject”. The default is usually “Approved” and “Rejected” as shown in the below screenshot.

image

The requirement is something like this.

image

Solution

  • You have to create a custom content type
    • Go to Site Settings –> Site content types –> Click Create
        • Fill Name and Description field
        • Select “List Content Types” under “Select parent content type from:”
        • Select “Workflow Task (SharePoint 2013)” "under “Parent Content Type:”
        • See the screen shot.

      image

        • Click OK
        • Once the page is redirected to the content type page ensure that the parent of the content type is Workflow Task (SharePoint 2013)

image

  • Add new site columns with the options we need for new task out come.
    • On the Site Content Type Page under Columns click “Add from new site column”
    • Give the Column Name as your wish
    • The type of information in this column is: should be “Task Outcome”
    • and you have to give the choices in “Type each choice on a separate line:” text area. I have given Submit and Reject.

    image

  • Remove the default task out come from the created content type
    • Click on Task Outcome under Columns section and click Remove.
  • Lets assign set the outcome option with the above create content type
    • Create a List workflow through SharePoint designer 2013
    • From the action menu add Assign a task action
    • Click this user and set the Participant and task title
    • Click Outcome options and select the content type created here the name of the content type is “Name” as we created above.

    image

  • Now we can get the output values from the workflow in the designer.

image

  • When we select the custom content type we will get an alert in read saying “Check to make sure this content type is applied to the workflow’s task list”
    • When we assign a task the task is created in a separate list. The default is Workflow task list. We can create as we want.
    • We can see the task list in workflow settings page

image

  • We have set the above created content type to the workflow task list.
    • Go to Workflow task list (Or your custom task list) through site content page
    • Then List Setting –> Under Content Types click “Add from existing site content types”
    • Add the content type we created.

image

    • Click OK.

That's all.

Conclusion

Now once we assign a task the task will have the above created outcome options in the tasks item. Don't miss the point associating the content type with the task list; else you will get a exception.

5 comments:

  1. Can we create custom task form for edit task operation?

    ReplyDelete
  2. Does it applies to Sharepoint 2010

    ReplyDelete
  3. if we click on any of custom value button, the %complete becomes 100 and the task is getting completed. How can we stop changing the %complete value

    ReplyDelete
  4. Nice tutorial, very explanatory and why each step is necessary.

    ReplyDelete
  5. I'm surprised that you didn't explain the red error message, "Check to make suer this content type is applied to workflow's task list." There's an MSDN blog post which also fails to explain this point. https://blogs.msdn.microsoft.com/sharepointdesigner/2012/09/14/how-to-manipulate-the-task-form-with-sharepoint-designer-for-new-task-actions/

    ReplyDelete