cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Melio
Level: Powered On

Flow that checks for existing SharePoint item

I have seen many topics on this issue but mine is a bit different.

I am doing a "Traning Record" system where users input data via InfoPath form. This form contains 30 lookup of student IDs, test scores, a lookup of course name etc. The form creates an item in a SharePoint list called "Course Register." I also created 6 views in SP, each view with 5 student lookup fields. This is because of the 12 threshold limitation.

Then, I created 6 flows each triggered by "When an item is created or modified" with limited columns view and Filter array title eq 'Title'. Each flow creates 5 items in the second SP list called "Student Record. " Each item in this list must contain Student ID, Course Name, Date/Time, Venue, Scores etc.

Ex. Student Record
-N123, Math, 2/12/19, Score 90, Passed
-N124, Math, 2/12/19, Score 95, Passed
-N143, Math, 2/12/19, Score 50, Failed

Followed by "Get Items" and a "Condition." The condition is "@equals(length(body('Get_items')?['value']), 0)" - YES to "Create Item" and NO to "Update Item."

Now, this worked fine for the first 1-5 view because Get Item's body was 0. But, from 6-10 view and onward failed because body wasn't 0 anymore and it went to If No and tried to update.

I have tried condition "if N123 equal to StudentID." Didn't work.

To sum up: I have 2 SP lists, 1
contains everything and the other contains extracted information of the first one. 6 flows that work at the same time to extract 1 item to 30 items. Each flow creates 5 items in the second list.

I use infopath because I need to print the form out.

Please suggest a better solution. Thank you.
1 ACCEPTED SOLUTION

Accepted Solutions
Melio
Level: Powered On

Re: Flow that checks for existing SharePoint item

Thank you for the quick reply.

 

This condition "@equals(length(body('Get_items')?['value']), 0)" works for only the first flow. I had 6 flows with all with the same condition and actions but only a few different in create item and update. The first flow ran, the condition was equaled to 0, it created - this is good. But when the second flow started, it did see condition as not equal to 0. 

 

This is what I am doing now. Don't know if it will work.

1.jpg4.jpg

"When an item is created or modified" is triggered in the Course Registeration list. This is how my InfoPath form looks like. Table in the form is fixed table not repeating table so each field does not depend on one another (Student ID 1 is ID1, Student ID 2 is ID2, score 1 labeled as SC1, score 2 labeled as SC2 etc.). As you can see, I have 30 students (sometimes less) in one class. Instructor choose lookup student IDs in the form without scores first. I also limited in "When an item is created or modified" to only to 1-5 students in order to avoice the threshold. 

 

That means, once a course is created in Course Register list, student IDs in the form should populate themselves separately in Student Record list. 

 

I am trying something new now. I have just added 6 more "Get items" actions this morning. They get data from Course Register list which each one limited to only 5 lookups.

6.jpg

 

 

Next, I use "Get item" from Student Record list and then "@equals(length(body('Get_items')?['value']), 0)" condition. 

2.jpg

 

If it returns 0, it creates SP items in Student Record list.

3.jpg

 

This is my new approch. I tried using 6 flows at the same time and they didn't work.

View solution in original post

2 REPLIES 2
v-lin-msft
Level 10

Re: Flow that checks for existing SharePoint item

Hello @Melio,

 

According to your description, do you want to transfer all InfoPath information to a SharePoint list with multiple views?

Can you show me some details of your SharePoint list column and flow configuration as well as screenshots of your error messages? So we can help you better. I have configured a similar flow and SharePoint list according to your description

I have made a test on my side and the flow works well.Annotation 2019-05-16 121742.png

 

 

Annotation 2019-05-16 122224.png

 

View1:

Annotation 2019-05-16 122029.png

View2:

Annotation 2019-05-16 122053.png

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.

Melio
Level: Powered On

Re: Flow that checks for existing SharePoint item

Thank you for the quick reply.

 

This condition "@equals(length(body('Get_items')?['value']), 0)" works for only the first flow. I had 6 flows with all with the same condition and actions but only a few different in create item and update. The first flow ran, the condition was equaled to 0, it created - this is good. But when the second flow started, it did see condition as not equal to 0. 

 

This is what I am doing now. Don't know if it will work.

1.jpg4.jpg

"When an item is created or modified" is triggered in the Course Registeration list. This is how my InfoPath form looks like. Table in the form is fixed table not repeating table so each field does not depend on one another (Student ID 1 is ID1, Student ID 2 is ID2, score 1 labeled as SC1, score 2 labeled as SC2 etc.). As you can see, I have 30 students (sometimes less) in one class. Instructor choose lookup student IDs in the form without scores first. I also limited in "When an item is created or modified" to only to 1-5 students in order to avoice the threshold. 

 

That means, once a course is created in Course Register list, student IDs in the form should populate themselves separately in Student Record list. 

 

I am trying something new now. I have just added 6 more "Get items" actions this morning. They get data from Course Register list which each one limited to only 5 lookups.

6.jpg

 

 

Next, I use "Get item" from Student Record list and then "@equals(length(body('Get_items')?['value']), 0)" condition. 

2.jpg

 

If it returns 0, it creates SP items in Student Record list.

3.jpg

 

This is my new approch. I tried using 6 flows at the same time and they didn't work.

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 66 members 3,459 guests
Please welcome our newest community members: