cancel
Showing results for 
Search instead for 
Did you mean: 
David_Nguyen

Flow with "When an item is created or modified" triggers old events

SCENARIO

========

 

When you create a flow with SharePoint trigger like "When an item is created or modified", you want your flow only triggers when the new item is created or modified. However, when you turn off the flow, make modification to the items, then turn on the flow, the flow still triggers for that item's modifications.

 

This is a known issue of this kindly of trigger. 

 

The trigger "When an item is created or modified" uses the triggerstate property to define when was the last trigger time. This is implemented in the back-end process.

 

As the trigger tries to check from the triggerstate regardless the flow is turn on or off, when you turn on the flow, the process when scan for all modified items based on the trigger state.

 

For example: 

1- You create a flow "When an item is created or modified" => Send me an email.

When the flow is triggered, it stores a triggerstate property in the API call as triggerstate="2020-12-10T12:12:12:000Z"

2- Now you turn off the flow, during one day, you make changes to the items in the list set in the trigger.

 

3- You turn on the flow at "2020-12-11T12:12:12:000Z"

 

4- The system check for new data to fire the trigger, but the system scan from the triggerstate="2020-12-10T12:12:12:000Z" to the 

timstamp when the checking process starts. ( "2020-12-11T12:12:12:000Z")

 

At the moment, this is a known issue as the Sharepoint connector use A polling trigger (such as the recurrence trigger) and use the triggerstate as time for starting the scan.

 

You can learn more about this at: 

 

Troubleshoot common issues with triggers - Power Automate | Microsoft Docs

Schema reference for trigger and action types - Azure Logic Apps | Microsoft Docs

Create web APIs & REST APIs for Azure Logic Apps - Azure Logic Apps | Microsoft Docs

 

WORKAROUND

==========

 

Set the start timestamp for the trigger in the TRIGGER CONDITION:

 

@greater(triggerBody()?['Modified'],'2020-12-15T05:46:12Z')

 

This syntax will make sure the flow only trigger when the item is modified after '2020-12-15T05:46:12Z ( the time when we will turn on the flow)

 

image.png

 

Hope this helps you understand about the triggering behavior of Sharepoint connector.

 

David Nguyen

 

 

Comments
Anonymous

Thanks David,

 

Are we saying that before we turn off flows

  1. add pre determined Date/time in the future as a trigger,
  2. This prevents any flows running when an item is created or updated as they are in the past.
  3. The remove the pre determined Date/time trigger
  4. This allows the flows to run with a item is created or updated
  5. then turn the Flow back on

Hope this makes sence

 

Dave

Hi @Anonymous 

 

The trigger condition will define what should be triggered.

 

We put the Modified filed with the date time in the future timestamp or when you expect to have trigger. The flow will only trigger for record satisfy the Trigger Condition.

Hi @David_Nguyen ,

 

Good work-around for this common issue.

In trigger conditions it's better to set this formula instead of typing date manually everytime : 

"@greaterOrEquals(triggerBody()?['Modified'],addMinutes(utcNow(),-1))"

Thank you David for posting this workaround.

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/