Monday, July 13, 2009

SharePoint workflow in ASPX - Part 5

The final part of the process. We read the workflow values from ASPX page, now if anybody clicks approve or reject or any action, accordingly the workflow should react. To achieve this, in the task form, create a Hashtable and add item keys with the same name of Task After Properties and its value like this,
Hashtable taskProps = new Hashtable();
taskProps.Add("ApprovalStatus", "Approved");
taskProps.Add("Comments", "Approved");
taskProps.Add("CurrentUser", "NAME");
Now pass the value to workflow by calling the below functin,
SPWorkflowTask.AlterTask((SPListItem)item, taskProps, true);

Hope you got an idea of how to do this....

No comments: