I need to create a custom outcome for a workflow task assigned to someone.
This is what I did:
1. I've created a custom site column as a Task Outcome column.
2. I've added the custom column to a content type which is based on a Workflow task content type.
3. In Sharepoint Designer, in the workflow, I select the custom content type in 'Outcome Options'. This works perfectly.
When I run the workflow, it assigns the task, give the custom options to select from. But when I complete the task, the workflow does not see that the task is completed. I manually have to update the 'Task Status' as well. This does not happen when I use the default workflow task content type. Why is this, and how do I get the workflow to automatically update the task status.
3 Answers
May be this can help you.
Task Outcome column use choicebuttonfieldtemplate.js
script to render additional buttons with your custom outcomes before default Save and Cancel buttons.
Generated buttons do this things:
- Set Status field value to "Complete" status
- Set PercentComplete field value to 100
- Set "Your custom outcome" field value to value of clicked button
- Click Save button
Main restriction to script work is that Save button, Status field, PercentComplete field must be rendered to page before Task Outcome field
Use CSR/JS link for Workflow Task EditForm or add Script Editor webpart to EditForm. In the script add onclick handler to Outcome button(s) and in the handler change Workflow Task Status HTML filed to "Completed".
I revisited this question of mine and in the meantime got another solution without any coding.
You create a custom content type (inherit from workflow task) and then add a custom 'Task outcome' site column.
For example: You have a Manager approval content type that should give output Approve or Decline.
1. Create custom content type: ManagerFeedback, inherited from Workflow task.
2. Create a site column, ApproveDecline with type: Outcome choice and add 2 choices: Approve and Decline.
3. Go back to the newly created custom content type, remove the 'Outcome choice' column and add the ApproveDecline custome column.
4. Review the columns/fields for your custom content type, you can 'hide' fields you do not want to show in the task. BUT important: % Complete and Task Status should ALWAYS be marked as Optional or Required.
5. Click on the column order link and ensure that your custom column, is the last column in the order.
6. Also ensure that this custom content type is added to your task list that receives the tasks from the workflow.
7. Assign the content type to your workflow task and test.
When you get to the task that have the custom content type, the buttons will now show as 'Approve' or 'Decline'.
NS: I've edited my custom content type, by adding the Comment field. This 'broke' the task and showed my custom output choice column as a dropdown, in stead of buttons. I had to remove the custom output choice column and re-add it again. Hope this help someone else ;-)