Question

Second workflow keeps restarting

  • 15 August 2023
  • 9 replies
  • 109 views

Badge +3

Hi,

I have a form that is a two part form and two workflows associated to the form.

  • When the first section of the form is filled out, it triggers Workflow#1  based on When Items are created.
  • Workflow#2 is set to trigger when Items are modified and when a yes/no question is not empty. 
  • Users are allowed to go back to the form when they need to fill out the second half of the form if they do not have the information to fill it out at first 
  • If the second part of the form hasn’t been filled out by the user, the user gets an email reminding them to fill it out. (Refer to: @bamaeric solution

Right now both workflows run fine, however once they both complete, Workflow#2 restarts again. It happens with every submission  

How can I set the workflow settings to stop Workflow#2 from running again after it has already completed? 


9 replies

Userlevel 6
Badge +22

HI @nikitapatel,

You could try creating a column called “Workflow 2 ran” or similar and when workflow 2 runs have it update this column to YES.  Then in your condition for workflow 2 you can add “Workflow 2 ran = no”.
This way workflow 2 can only run once.

Badge +3

However, in all cases, Workflow#1 will always run when the submit button is clicked.

With your suggestion, when the submit button is clicked the column would update to YES. If I set Workflow#2 settings to run when Workflow 2 ran = NO, it wouldn’t run Workflow#2 at all.

I need both workflows to run.

  • Workflow#1 runs when the submit button is clicked.
  • Workflow#2 runs when the item is modified and checks to see if a question was answered or not. If the question had a response entered then Workflow#2 should run.
  • The issue is that once both workflows complete, Workflow#2 starts running again without any modifications being made to the form.
Userlevel 6
Badge +16

Hi @nikitapatel 

I believe that this is what @SimonMuntz is trying to say.

  • Workflow #1 - Upon clicking SUBMIT, a new Item is created, and this triggers WF #1
  • Workflow#2 - runs when the item is updated or modified
    AND when a yes/no question is not empty 
    AND “Workflow 2 ran = no”

You need to exercise caution when triggering a Workflow to run when the item is updated or modified.
That is the key reason to add additional conditions.
Every update to the item will trigger Workflow #2.
When Workflow #2 updates any column(s), this itself will trigger another Workflow #2 

  • The issue is that once both workflows complete, Workflow#2 starts running again without any modifications being made to the form.

Are you using multiple updates to the item when Workflow  #2 runs? How Many?

Badge +3

Here are my button settings:

 

Here are the WF settings for Workflow#2(Conference Contracts Workflow):

ConfOnsite? Is the question that asks if the conference is on site. For the workflow to trigger, it has to be either Yes or No. The WF settings do not allow me to configure it to “not empty”, so this is the approach I had to take with the criteria. FYI: Conference Details Flag is the column name I created for the approach that was suggested above.

 

Here is Workflow#2

This workflow basically checks to see how questions were answered on the form. Depending on the responses, different set of approvals get triggered. I didn’t use “update item” actions anywhere. I have used the Set action. Everything works fine… this workflow however keeps restarting. Idk if it is because of Workflow#1 running at the same time and setting fields.

 

Userlevel 6
Badge +16

Add a Log to History as the first item in Workflow #2
Display the values of both ConfOnsite? and ConferenceDetailsFlag.

This helps to show the values of those columns when the Workflow #2 is triggered.

What are the values of both ConfOnsite? and ConferenceDetailsFlag when the Workflow #2 first runs?
What are the values of both ConfOnsite? and ConferenceDetailsFlag when the Workflow #2 runs again?

Badge +3

Hi,

Workflow#2 ran multiple times. See below:

 

  1. ConfOnsite? Was answered Yes on the form. 
  2. Detailed view of each of the three workflow instances was the same

     

Badge +3

What I see happening is this:

  1. WF#1 has 4 approval tasks
  2. For every approval task that gets approved, WF#2 starts and ends in 3-4 completed instances
  3. Each approval task sets the response within the SharePoint list, could this be why WF#2 keep triggering?
Userlevel 6
Badge +22

Hi @nikitapatel 

This condition will not work.  You cannot mix AND and OR conditions as there is no way to add parentheses to group the statements.

For instance, this can be

(this OR this) AND this 

or it can be:

this OR (this AND this)
 

 

Badge +3

The settings originally only had ConfOnsite? = Yes OR ConfOnSite? = No…. So I can change it back to that. But it still triggers Worfklow#2 multiple times.

What else can I try to stop Workflow#2 from running over and over again? It seems to retrigger the workflow every time I hit approve for a flexi task for Workflow#1.

Reply