cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

I can't find the trigger I was using before. "when a new item is created"

Dear Community, please help me.
(I'm Japanese. I'm sorry if my poor English I mistaken.)


I builded an approval flow in SharePoint, using the trigger "when a new item is created" and REST service.


Next, I replaced The flow trigger with "When an item is created or modified".

(Because I wanted to incorporate a reapplication.)
Then a problem, Infinite loop occurred due to item update using REST service.
I tried to return the trigger to avoid the problem, but did not find the trigger "when a new item is created".


Please let me know if the trigger has disappeared from the flow ,And please let me know if you can prevent infinite loops.


Thank you for reading.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Brad_Groux
Super User II
Super User II

The When an item is created trigger still exists, here's the documentation. To stop an infinite loop from occuring, you need to make sure that you are using a condition with a logical expression that prevents an infinite loop, such as a time-based expression.

Official Documentation

Blog Posts

If you provide detailed screenshots of your Flow, we may be able to provide further assistance. 

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!

View solution in original post

v-lin-msft
Post Prodigy
Post Prodigy

Hello @Anonymous,

 

According to your reply, I think you have solved the problem of the create or modfied action disappearing and all that is left is to terminate the loop.

 

Here I to provide a method based on the new item creation time contrast creates an item on time to decide whether to create a new item, you can refer to this method of function, to create your flow.

 

Step1: Initialize two variable, one is array TimeList to storage time of item modifed, the other is Integer CountID set as the index of timeList, and please take a attention to set the Value as '-1'.Annotation 2019-05-13 105135.png

 

 

 

Step2: Create an action Apply to each, and append Time of modified to array TimeList. And increase CountID, value is '1'.

Annotation 2019-05-13 111202.png

 

Step3: Create a condition to determine whether the modification time of trigger is greater than one minute after the modification time of the previous item.

-If yes, create a new item or update item.

-If no, do nothing.

Annotation 2019-05-13 111619.png

The first blank:

formatDateTime(triggerBody()?['Modified'],'yyyy-MM-ddTHH:mm:ss')

The second blank:

addMinutes(variables('TimeList')[variables('CountID')],1,'yyyy-MM-ddTHH:mm:ss')

 

This way, the item created in the previous run can be avoided from triggering the loop to continue. Of course, if your flow takes a long time to run, you can set the time difference according to the actual situation.

 

Best Regards,

Community Support Team _ Lin Tu

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

6 REPLIES 6
Brad_Groux
Super User II
Super User II

The When an item is created trigger still exists, here's the documentation. To stop an infinite loop from occuring, you need to make sure that you are using a condition with a logical expression that prevents an infinite loop, such as a time-based expression.

Official Documentation

Blog Posts

If you provide detailed screenshots of your Flow, we may be able to provide further assistance. 

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!

View solution in original post

Anonymous
Not applicable

Hi, @Brad_Groux 


Thank you for your response.

 

I was able to understand the cause, thanks to you telling me about "When an item is created" trigger still exists.

The cause of missing trigger is notation fluctaitons of English-Japanese translation.

Machine translation is the cause.
It was written as "アイテム" or "項目" on flow edit web page and an "item" on flow template web page.

SharepointTrigger.png

 

I'm thinking about a few solutions about infinite loops.
I will consider a little more about the solution to the infinite loop problem.
Please give us your advice if you have any ideas.

 

1.Build a logical expression based on the difference between two times.
(It use Item metadata "Approval apprication date")

 

2.I use other trigger in plece of a logical expression.

I build two flows for new and for editing and I don't use a logical expression.
Because I want to reduce flow usage count.

v-lin-msft
Post Prodigy
Post Prodigy

Hello @Anonymous,

 

According to your reply, I think you have solved the problem of the create or modfied action disappearing and all that is left is to terminate the loop.

 

Here I to provide a method based on the new item creation time contrast creates an item on time to decide whether to create a new item, you can refer to this method of function, to create your flow.

 

Step1: Initialize two variable, one is array TimeList to storage time of item modifed, the other is Integer CountID set as the index of timeList, and please take a attention to set the Value as '-1'.Annotation 2019-05-13 105135.png

 

 

 

Step2: Create an action Apply to each, and append Time of modified to array TimeList. And increase CountID, value is '1'.

Annotation 2019-05-13 111202.png

 

Step3: Create a condition to determine whether the modification time of trigger is greater than one minute after the modification time of the previous item.

-If yes, create a new item or update item.

-If no, do nothing.

Annotation 2019-05-13 111619.png

The first blank:

formatDateTime(triggerBody()?['Modified'],'yyyy-MM-ddTHH:mm:ss')

The second blank:

addMinutes(variables('TimeList')[variables('CountID')],1,'yyyy-MM-ddTHH:mm:ss')

 

This way, the item created in the previous run can be avoided from triggering the loop to continue. Of course, if your flow takes a long time to run, you can set the time difference according to the actual situation.

 

Best Regards,

Community Support Team _ Lin Tu

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

Anonymous
Not applicable

Hello, @v-lin-msft 

 

Thank you for your response and wonderful idea.

I would like to combine you and my ideas to build a flow.

 

If you can see my idea (used the conditions on"if"), please see below.

flow分岐.png

 

 

Yes, I can see, and what' your problem during you use the flow?

Anonymous
Not applicable

Hi, @v-lin-msft 

So far, so good. 

I will show you when this is complete. Thanks!

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 (1,427)