cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vontovius
Frequent Visitor

Flow item was create/modified

Hi everyone

I want to build a flow with trigger by create/modify item in sharepoint >

1/ if item is created > it will send email inform item create via email and asking for approval

2/ if item is modify > it will send email inform item modified via email

Below is my flow:

 
 
2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Vontovius ,

 

Take a try to create the flow as below:

1.png

Expression for the first value in the Condition:

addMinutes(triggerBody()?['Created'],1)

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi, Thanks everyone, I found the answer:
1/ go to sharepoint> list setting> versioning setting> turn on "create a version each time you edit an item in this list"> keep the following number of version: 2

2/ Apply the version number compare method as flow belowUntitled1.jpg

View solution in original post

7 REPLIES 7
efialttes
Super User III
Super User III

Hi!

I am afraid you forgot to post a screenshot from your flow design.

FRom the text description it seems you are using trigger 'when an item is created or modified', right?

If so, the way to distinguish if trigger is executed when item is created vs modified is by comparing two Sharepoint related trigger outputs:

triggerBody()?['Created']

triggerBody()?['Modified']

If both of them match (equals operator) then flow was trigger due to item creation, if not due to item modification

https://powerusers.microsoft.com/t5/I-Found-A-Bug/Flow-Existing-item-is-modified-triggers-when-a-new...

Hope this helps

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



v-alzhan-msft
Community Support
Community Support

Hi @Vontovius ,

 

I couldn't see your flow that you mentioned.

And the trigger "When an item is modified" of sharepoint is not supported in Microsoft flow currently, supported trigger in "When an item is created" and "When an item is created or modifed".

If you want to do different action for created or modified item, I suggest that you could add a "Operation" field with Choice type, the default value for the Operation field should be Created.

And then you could let the user to:

When create an item in the list, set the Operation field to Created.

When Update an item in the list, set the Operation field to Updated.

 

Then you could create the flow with trigger "When an item is created or modified", and add a Condition under the trigger to check if Operation field Value dynamic content is equal to Created, you could add different action inside the If yes and If no branch of the Condition.

 

Another way is @efialttes  suggested, you could compare the Created time with the Updated time, however, sometimes the Created time wouldn't equal to the Updated time when an item is created, the alternative way should be check if the Created time+5 minutes is greater than the Updated time (Make sure you wouldn't update the item in 5 minute after the item is created), If yes, this should be a new created item, If no, this should be a Updated item.

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

flow errorflow error

It seems if I update item less than 5 minute or even I created a new item, it always go to no branch - could you please kindly help me? I do not want to wait more than 5 minutes - the trigger should work as intention please

Hi @Vontovius 

 

You can directly compare the values in the condition branch instead of adding variables. 

 

In the left box for condition, select modified and then select operand as greater than or equal to and then in the right, type addseconds function and then in the () select the created field and set the add seconds as 5. This will check the created against modified + seconds and run as expected. 

 

The share point triggers are recurrence based so that is why it might take some time for the flow to trigger. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS! 

Hi @Vontovius ,

 

Take a try to create the flow as below:

1.png

Expression for the first value in the Condition:

addMinutes(triggerBody()?['Created'],1)

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi, Thanks everyone, I found the answer:
1/ go to sharepoint> list setting> versioning setting> turn on "create a version each time you edit an item in this list"> keep the following number of version: 2

2/ Apply the version number compare method as flow belowUntitled1.jpg

View solution in original post

Hi @Vontovius ,

 

Glad that your problem could be solved.

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (2,072)