Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Being new on the whole Sharepoint administration scene, I need a little help from those in the know.

I may be doing this "completely" wrong, so apologies if I am and I would really appreciate your help finding a better way if so.

Basically, I have a workflow that contains 6 steps. These 6 steps contain conditions that check the current item's status and perform actions based on it.

The natural progression of the workflow means that once it performs an action, it continues to move down the path till it ends. The problem I have, is that in two of my steps, based on an approval process being rejected, I change the current item's status to a status that is checked in a step above the one that created. As a result, it does not get executed until the workflow is run manually or by editing the item.

I incorrectly assumed that upon setting a field on the current item, it would be classed as modified and then would start the workflow again on the current item.

Does anyone know of a way of restarting the workflow on the current item, from within the workflow?

Edit: Hopefully seeing this will help, I'm working on a Visio diagram as well:

#### STEP 1 #####################################################################################################
if Current Item:Status equals "Awaiting tech review"
    Start CR Tech Review Approval process on Current Item with "CR Tech Review"
    if Variable:IsItemApproved equals "Yes"
        Set "Status" to "Awaiting board review" // Step 2
    else
        Set "Status" to "Rejected by tech"
        then Stop the workflow
#### STEP 2 #####################################################################################################
if Current Item:Status equals "Awaiting board review"
    Start CR Board Review Approval process on Current Item with "CR Board Review"
    if Variable:IsItemApproved1 equals "Yes"
        Set "Status" to "Awaiting allocation"
        then Collect data from CR Project Management
        set "Assigned to" to "Tasks:Allocated to" // from above Collect data from user
        set "Status" to "Allocated to developer" // Step 3
    else
        Set "Status" to "Rejected by board"
        then Stop the workflow
#### STEP 3 #####################################################################################################
if Current Item:Status equals "Allocated to developer"
    Collect data from Current Item:Assigned to
    then set "Status" to "Awaiting deployment to 'TEST'"
#### STEP 4 #####################################################################################################
if Current Item:Status equals "Allocated to developer - bugs found"
    Collect data from Current Item:Assigned to
    then set "Status" to "Awaiting deployment to 'TEST'"
#### STEP 5 #####################################################################################################
if Current Item:Status equals "Awaiting deployment to 'TEST'"
    Start CR Build Management Approval (TEST) process on Current Item with "CR Build Management"
    if Variable:IsItemApproved2 equals "Yes"
        Set "Status" to "Awaiting deployment to 'LIVE'" // Step 6
    else
        Set "Status" to "Allocated to developer - bugs found" // Step 4
#### STEP 6 #####################################################################################################
if Current Item:Status equals "Awaiting deployment to 'LIVE'"
    Start CR Publish Authorisation process on Current Item with "CR Board Authorisation"
    if Variable:IsItemApproved3 equals "Yes"
        Start CR Build Management Approval (LIVE) process on Current Item with "CR Build Management"
        if Variable:IsItemApproved4 equals "Yes"
            Set "Status" to "Completed"
            then Stop the workflow
        else
            Set "Status" to "Allocated to developer - bugs found" // Step 4
    else
        Set "Status" to "Rejected by board"
#################################################################################################################**strong text**

and a diagram that shows how it should work. Hopefully you can follow it:

Diagram

Cheers

Gavin

share|improve this question
    
Didn't understand your question.By the way, a workflow can be started when a list item changes –  Amit Kumawat Nov 18 '11 at 13:09
    
@AmitKumawat: My workflow is setup to start on both creation and modification of an list item. This is fine, the problem is I need to start the workflow when a condition within the workflow is reached. –  Gavin Nov 18 '11 at 13:16
    
If you need to restart, you can edit the item (increment version or a hidden field) from the workflow when the condition is reached and terminate existing workflow. It should kick off a new workflow –  Amit Kumawat Nov 18 '11 at 13:23
    
@AmitKumawat: Thanks... Although isn't that what I'm already doing? I'm changing a column of the item in the list (called status) to a different value, or do I need to stop the workflow too? –  Gavin Nov 18 '11 at 13:34
    
To start a new one,You need to terminate the running workflow too –  Amit Kumawat Nov 18 '11 at 13:38
show 1 more comment

6 Answers 6

Sharepoints Workflow isnt entirely sequential, the Approval Process has overall behavior and individual task behavior.

Individual Tasks are sequential, but the workflow can repeat any number of tasks. The trick is getting them to repeat the way you want.

Here's a simpler solution.

Simulate a loop back behavior (on Approval Process only):

In the Task Behaviors portion of an Approval Process, Add an action to the "When a Task Completes" Step. In the If clause: "Else if Current Task: Rejected", add an Action that says "Append a new task and assign to __". Each time the Task completes as Rejected it will create a new task and the Approval Process will essentially Loop.

You'll also notice pre-existing task Comments are appended to new task.

Note: Task Behavior Completion Settings must be set to complete only If FutureTasks:0

share|improve this answer
add comment

This is a common issue with people new to SharePoint: they try to replicate the steps of the business process. And the integration with Visio doesn't help.

Instead of having all the different steps in the workflow, here is what I usually do:

  • check the status
  • do stuff based on the status value
  • stop the workflow

This way, the above workflow will run as many times as needed, every time the status changes, until the process is complete. Loops are easy, you just set the status to a previous value.

Let me know if you need more details.

share|improve this answer
    
That is the problem... I have tried using the "set value on current item" and "update item" actions and then ending the workflow directly afterwards and it does not start the workflow again. Even though the workflow is setup to start on creation and modification of the item it self. Any idea's? Cheers –  Gavin Nov 23 '11 at 8:53
    
If I understand your process, the workflow is not supposed to start again. It should wait for an external input to go to the next step. –  Christophe Nov 23 '11 at 20:18
1  
If you need loops (workflow restarting itself), this is not allowed. Workarounds are to either include a pause in the workflow, or have two twin workflows that trigger each other (!). –  Christophe Nov 23 '11 at 20:19
add comment

First of all a remark: When you have the "Start workflow if edited" selected, this will also start the workflow when the item is created. So maybe you don't need the "start manual" then?

I think the the workflow will start again when you first modify the field, then use the action to stop the workflow. (My anwser is based on sharepoint 2010, maybe 2007 is different)
I didn't test this though...

share|improve this answer
    
Thanks, as stated on my comments below my OP, the workflow starts on creation and modification of the list item. This is fine, the problem is, that due to the sequential nature of the workflow, it's hard to loop based on a specific requirement. FYI, I am using 2010 as tagged. –  Gavin Nov 18 '11 at 13:38
add comment

If the steps are sequential until completion, you need to have some logic in the workflow to evaluate if the status is rejected, then end the workflow. You'll need a secondary workflow on the list that fires on item change looking specifically for rejected states and process the item from there on.

Other third party workflow tools like Nintex and K2 allow you to terminate and restart workflows.

share|improve this answer
    
Thanks, each of my steps have a condition preventing the actions within from running unless the condition is met. Using the "set field in current item" updated the item, but did not start the workflow based on the item being modified. –  Gavin Nov 18 '11 at 13:40
    
Try using the Update item action and see if that makes a difference. –  PirateEric Nov 18 '11 at 13:44
    
Just tried that ;) Unfortunately not. It just stops. I'm now trying @AmitKumawat's suggestion and to issue a Stop the workflow action after updating the item. Cheers –  Gavin Nov 18 '11 at 13:51
    
Tried updating the item and then ending the workflow with no results. This simply does as you'd expect, updates the item and ends the workflow lol. I think I need to create some screen shots or a flow chart of my process. –  Gavin Nov 18 '11 at 13:56
    
You need a secondary workflow that fires on item change or build in Else If logic into subsequent steps on what needs to happen if the status from the previous step is rejected. –  PirateEric Nov 18 '11 at 14:40
add comment

May be this link can help you : Create a secondary workflow

share|improve this answer
add comment

Use this link SPDActivites to start another workflow from within a SharePoint designer workflow... Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.