I have a state machine workflow that I created in VS2010 for SP2010.
I would like to have the WF utilize 2 different task lists. One task list for tracking approvals and one task list for tracking assigned deliverables. However, it seems like the workflowProperties.TaskList is locked down and I am unable to modify the task list "location" as the workflow progress from state to state.
Is it possible to have a custom workflow utilize multiple task lists? How do I do it?
My main reason for doing it this way is that I want simplified status fields for my tasks. On the approval task list the only status values will be Accepted, Rejected, Escalated, Pending. While on my deliverable task list I would like the default choices of Not Started, In Progress, Complete, Waiting, Deferred. If there is a better way than using two different customized task lists, I am open to suggestions.
Same problem here. I'm creating a static workflow machine.
It is possible to create a task by just adding an item to the list. I mean not using: Microsoft.SharePoint.WorkflowActions.CreateTask();, but just add an SPListItem to an SPLIst.
The advantage is the you can add a task to every list on every site level. But is it possible to combine these task to an OnTaskChanged()? If not, is it a good idea to use an EventReceiver which triggers my forkflow steps?
Related
I am using SharePoint Workflow 2010 in SharePoint Designer 2013.
I created a workflow which consists of a Parallel Block running two Task Processes A and B. I want to quit the Parallel Block and end the workflow as soon one of them has finished. But I could not find out a way to accomplish this for SharePoint Workflow 2010. I have tried out the following until now:
If I right click on the parallel block and click on "Advanced Properties" then there is a property "CompletionCondition". But there are just the option YES and NO. I know that in SP Workflow 2013 you can use Local Variables, but here you can't select anything. Even the YES and NO are not selectable. This property seems not work!
Another idea I had was the following: I tried to communicate between the two parallel task processes via a column in the item the workflow is running on. So, I created a column Status in the item list. When Task Process A is finished it will set the Status column to 1. The same is true for Task Process B. Then I inserted the action Wait for Field Change in Current Item in each of the task processes to monitor the Status column. If I just add the Wait for Field Change in Current Item in one of the Task Processes e.g. Task Process A and Task Process B completes and sets the Status=1 then Task A is triggered and is able to call End the Task Process. So this works. But I need the same in the opposite direction, i.e. inserting Wait for Field Change in Current Item also in Task Process B. But doing so results in an error message if change a task in the SharePoint task list: the task is currently locked by a running workflow and cannot be edited. It seems that using this feature in both Task Processes results in two many parallel processes which lock each other.
So, is there way to simply end the workflow if one of the actions (Task Processes) in the Parallel Block completes (using SharePoint Workflow 2010)?
I am new to SharePoint. Sorry if answer to my questions is obvious.
First question: I have state machine workflow which creates about 30 tasks (some of them creates after previous completed using OnTaskChnage activity). I have to log tasks changes and complete workflow when all tasks completed. I see 2 ways to do it:
1) I can create eventDrivenActivity for every of 30 tasks.
OnTaskChanged
--Code (log changes)
--If (allTaskCompleted()) //not code, but activity, what use
----then SetState(Completed); //condition allTaskComplete() from code
But I think it is not good way because of I can't reuse code and do 30 same steps.
2) I can do loging in code and then if need, complete workflow from code, but I don't know how can I do it. I can cancel workflow from the code
SPWorkflowManager.CancelWorkflow(itemWorkflow);
but I can't find any information, how to complete it (or setState to "Completed"). May be I am doing something wrong and workflow have to complete itself then all tasks completed, but it does not happen (It stays in "In progress").
Second question: Is there any possibility to run some code after every change in workflow tasks (as far as I understood, OnWorkflowChanged and OnWorkflowModified not suitable for my needs), or to add programmatically handler to my 30 tasks (not to Tasks list at all, but only for my tasks)?
Thank you in advance.
Best regards
Mikhail.
PS: sorry for my writing. English is not my native language.
This might seem like a silly thing to say, the final branch in a parallel activity so I'll clarify. It's a parallel activity with three branches each containing a simple create task, on task changed and complete task. The branch containing the task that is last to complete seems to break. So every task works in it's own right, but the last one encounters a problem.
Say the user clicks the final tasks link to open the attached infopath form and submits that. Execution gets to the event handler for that onTaskChanged where a taskCompleted variable gets set to true which will exit the while loop. I've successfully hit a breakpoint on this line so I know that happens. However the final activity in that branch, the completeTask doesn't get hit.
When submit is clicked in the final form, the operation in progess screen says of for quite a while before returning to the workflow status page. The task that was opened and submitted says "Not Started".
I can disable any of the branches to leave only two, but the same problem happens with the last to be completed. Earlier on in the workflow I do essencially the same thing. I have another 3 branch parallel activity with each brach containing a task. This one works correctly which leads me to believe that it might be a problem with having two parallel activites in the same sequential workflow.
I've considered the possibility that it might be a correlation token problem. The token that every task branch uses is unique to that branch and it's owner activity name is est to that of the branch. It stands to reason that if the task complete variable is indeed getting set to true but the while loop isn't being exited, then there's a wire crossing with the variable somewhere. However I'd still have thought that the task status back on the workflow status page would at least say that the task is in progress.
This is a frustrating show stopper of a bug for me. Any thoughts or suggestions would be much appricated so I can investigate them.
my workflow scenario is to reassign task to it's originator after due date of the task expires, by firing a delay activity.
in my workflow I have a parallel replicator which is used to assign(create) different tasks to different users at the same time.Inside replicator I used a listen activity so in the left branch there is a OnTaskChanged activity+...+ completetask1, In the right branch of listenActivity there is a Delay Activity followed by a CompleteTask2 activity and a code activity to reassign task to task originator.I'm sure about the correlation tokens on both completetasks activities.every thing works fine on the left branch but error occurs in the right branch which contains Delay activity-->Completetask activity.
let consider that we have two tasks assigned to 2 users and they have one hour to complete their tasks, but they didn't.so Delay activity fires for both tasks.then in workflow first task will be completed but for the second task it makes error.
I think the problem is with taskid property of the completetask.it doesn't updated with the second task id, so it tries to complete a task which has been completed.
I have a process that requires approval from any two people out of a group of four or five. I'd like to create a task assigned to each person, and after two of those tasks are complete, delete the remaining tasks and move on with the workflow.
Is there a way to create multiple tasks with a single CreateTask activity? Also, I'm still fairly new to WorkFlow, so if I store the TaskIDs in an array, can I iterate over them to delete the remaining tasks after the fact?
Or am I going about this entirely the wrong way? I'm open to suggestions.
I am not sure if they apply to Sharepoint, but check these posts from Matt Winkler:
Different Execution Patterns with WF (or, Going beyond Sequential and State Machine)
Implementing the N of M Pattern in WF
I think that the second post describes exactly your case.
I created a StateMachine workflow for sharepoint and at one state, I create multiple tasks using a replicator. The number of tasks created is variable.
I need to handle the OnTaskChanged event for all the tasks I created which seems impossible as one event handler can only be associated with one task.
I can use a restrictive number of tasks which can be created and handled by a specific number of handlers but I am considering that as a last resort or create a sequential workflow as a last resort.
Please do let me know if this is even supported or if there are any workarounds.
Reference Link: http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/a174ac5f-03ed-4e27-998b-bbdb7d01d09b/
It won't work for the reasons you laid out. The workaround is to restructure your state machine workflow as a sequential workflow (which may not be possible) or to switch to item event receivers (which may not work for you). I've actually blogged about this topic: Workflow Nuttiness vol. 1
Hilariously, I just checked the MSDN forums link you provided, and sure enough, I'm in that thread, asking "so, uh, I guess we all rewrite to sequential workflows?" And there's no better answer in that thread either :)