SharePoint Designer 2010 comes with huge improvements in its features. One of the very amazing improvements is designer’s workflows. Today I’m going to create a. Use this reference guide for a quick understanding of workflow actions available in Microsoft SharePoint Designer 2010. Tim Coalson discusses Updating the Task Approval Form for the “Out of Box” SharePoint Approval Workflow.
Programmatically set the outcome of Share. Point Tasks. Hi All,I have been trying to programmatically set the outcome for an approval task in Sharepoint 2. I created a sample SP Designer workflow to assign two tasks in parallel to users on my computer, so two approval tasks are created when an item is added to my forms library. I have a console app that should update the status of fields in the task list, but only the %complete and status are updating, not the Outcome.
I have seen other posts on the web but they don’t seem to resolve this issue in my case. As a test I created a workflow that assigns only one approval task when a new item is created (instead of two parallel tasks) and used my test app to update the status and outcome of the task and it worked.
There seems to be an issue with the outcome task not updating if parallel tasks are used in the workflow. Are you aware of what could cause the Outcome task for each item not to be set if the tasks were defined in parallel actions?
I have attached the console app that I use to change the outcome of the task. Thanks in advance,Phil. Program { static void Main(string[] args) { SPSite mysitecoll = new SPSite("http: //mysite"); SPWeb web = mysitecoll. Open. Web("Projects/Test. Site/"); try { SPList device. Leavers = web. Lists["Exit.
Checklist"]; SPList. Item item = device. Leavers. Items[0]; SPWorkflow. Task taskedit = null; SPWorkflow. Task. Collection task. Collection = new SPWorkflow. Task. Collection(item, new SPWorkflow.
Filter()); foreach(SPWorkflow. Task task in task. Collection) { //Check if the task is the manager's approval task if (task[task. Fields["Status"]. Internal. Name]. To. String() != "Completed") { if (task.
Title. Contains("manager")) { taskedit = task; Hashtable ht = new Hashtable(); ht["Completed"] = "true"; ht["Status"] = "Completed"; ht["Percent. Complete"] = 1. 0f; ht["Task. Status"] = "Approved"; SPWorkflow. Task. Alter. Task((taskedit as SPList.
Item), ht, true); Console. Write. Line("Task updated"); } } } } catch (Exception ex) { Console. Write. Line(ex. Inner. Exception. To. String()); } finally { Console. Read. Line(); } } }Select all.
Open in new window.