Solved

Same workflow on every item runs again after being approved

  • 20 January 2024
  • 5 replies
  • 53 views

Badge +4

I have a Nintex workflow on my sharepoint. Even after being approved by the users, it runs fresh again everyday. Why does it not complete and change status to complete than keep it in pending every day. Not sure, where the error could be.

icon

Best answer by mmasiddiqui 23 January 2024, 06:49

View original

5 replies

Userlevel 6
Badge +16

@mmasiddiqui 

You just provided a general view of the issue as such it is rather difficult to narrow down the root cause.

  • Possible LOOP issue with the code. State Machine returning to a previous point and returning back to said approval.
  • Incorrect setting of one or many variables causing flow to return back to said approval.
  • Workflow is triggered upon item updated.
    How is the workflow triggered? Upon new item creation? Upon item modified?

Can you provide further details?

  • How workflow is triggered?
  • What should happen after Approval?
Badge +4

Thank you for your time! Appreciate your help

 

After the workflow ends, the item should become non-editable with workflow marked as Approved. Strange thing I observed is that all approved items again change status everyday to new and restarts workflow.

Snapshot of workflow

Does that answer the two questions?

Userlevel 6
Badge +16

Hi @mmasiddiqui 

The root cause of the issue is because of the Workflow Trigger (triggered when the item is modified).

 

Example - The current last item in the list is Item #89. The next created item should be Item #90 (which is not yet created)

  1. New Form. Click SAVE.
    => Item #90 is create on the List. 
    => WF NOT triggered because “Summitted” value is empty (or not 1)
  2. Click SUBMIT.
    => Item #90 is updated. 
    => “Submitted” value is set to 1. (Not sure how you set this but take it that it works)
    => WF triggers because “Submitted” value equals 1
  3. Values in Item #90 is updated (eg Approval Date and Approval outcome etc)
    => Item #90 is updated. 
    => WF triggers again because “Submitted” value equals 1

This is what is cause the workflow to being triggered. 

How to fix the issue?
Prevent the workflow from being triggered by adding more conditions.
eg “isStarted” value is “yes”

 

WF Modified Condition
=> “Submitted” == “1”
=> “isStarted” != “yes”

 

When the workflow starts, change the value for “isStarted” to “yes”.
This will prevent the workflow from restarting when the item is updated.

Badge +4

Problem solved: Approach adopted…

Did analyze all columns and workflow tasks

I was not using the title field and Work task was indicating no title for all work task activity.

I added title update in the workflow to equate to the project name.

Then published and ran the workflow.

It finally worked without getting into loop. Beats me, what connection is there between the title field and the workflow loop.

Based on my analysis, if you are planning to use a workflow in the nintex form, you should make Title field mandatory.

 

Badge +4

Hi @mmasiddiqui 

The root cause of the issue is because of the Workflow Trigger (triggered when the item is modified).

 

Example - The current last item in the list is Item #89. The next created item should be Item #90 (which is not yet created)

  1. New Form. Click SAVE.
    => Item #90 is create on the List. 
    => WF NOT triggered because “Summitted” value is empty (or not 1)
  2. Click SUBMIT.
    => Item #90 is updated. 
    => “Submitted” value is set to 1. (Not sure how you set this but take it that it works)
    => WF triggers because “Submitted” value equals 1
  3. Values in Item #90 is updated (eg Approval Date and Approval outcome etc)
    => Item #90 is updated. 
    => WF triggers again because “Submitted” value equals 1

This is what is cause the workflow to being triggered. 

How to fix the issue?
Prevent the workflow from being triggered by adding more conditions.
eg “isStarted” value is “yes”

 

WF Modified Condition
=> “Submitted” == “1”
=> “isStarted” != “yes”

 

When the workflow starts, change the value for “isStarted” to “yes”.
This will prevent the workflow from restarting when the item is updated.

Thank you for your response and help!

Reply