Thursday, May 16, 2013

SharePoint 2013 Workflow error : Custom outcome column returns default option as a task result


I was facing weird issue in SharePoint 2013 Designer workflow.
Scenario was,
I wanted to create one list workflow where custom list was created programmatically and having my custom workflow task list created through code as well custom content type and outcome columns also created programmatically.
Now in workflow stage having an Assign task action and in Outcome options using the above created content type and site columns, see the figure below:


Issue here I was facing, Task result was always showing "TaskOutcome:0" i.e the default Outcome in task inspite of I selected any another option.
example in above figure result was always coming "Action Plan Created".

Tried different approaches to make it work:

-While debugging tried various options to make it work, like installed update http://support.microsoft.com/kb/2767999
where it mentioned that
"Assume that you use non-ASCII characters to name a task outcome field in a task in a custom workflow. Then, you change the default value in the task outcome field. In this situation, the task outcome field still displays the default value on the workflow status page."
but no luck with this as well)

- Tried to make the schema of custom outcome column same with SharePoint default TaskOutcome having however still same issue

- Any many other options tried but no luck.

After a week's debugging finally found the trick to solve this product bug.

1. Create one global variable after the Assign task step.


2. Set the global variable value to task outcome column explicitly.


3. Mapped it with assigned task's TaskID variable.


4. we are good to go, now we get the task outcome as a result which we select in task form.

Happy coding!


3 comments:

  1. Thank you Anuja! Great instruction - this fixed my similar issue using SharePoint Designer.

    Best Regards,
    Marc

    ReplyDelete
  2. this work perfectly but when i try assing a new task, dont work, the workflow status is running always and dont appear any error, someone can help me with this?

    ReplyDelete