Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to complete SharePoint 2010 state machine workflow when all tasks completed?
    text
    copied!<p>I am new to SharePoint. Sorry if answer to my questions is obvious.</p> <p><strong>First question:</strong> 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:</p> <p>1) I can create eventDrivenActivity for every of 30 tasks.</p> <pre><code>OnTaskChanged --Code (log changes) --If (allTaskCompleted()) //not code, but activity, what use ----then SetState(Completed); //condition allTaskComplete() from code </code></pre> <p>But I think it is not good way because of I can't reuse code and do 30 same steps.</p> <p>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 </p> <pre><code>SPWorkflowManager.CancelWorkflow(itemWorkflow); </code></pre> <p>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").</p> <p><strong>Second question:</strong> 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)?</p> <p>Thank you in advance. Best regards Mikhail.</p> <p>PS: sorry for my writing. English is not my native language.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload