cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lechrisvan
Regular Visitor

Condition errors when get items return empty Sharepoint record

Hi,

I'm building a flow getting records from one Sharepoint list (List 1), then use the Title field from List 1 to search for records from another Sharepoint list (List 2). If Title field in List 2 matched, update List 2 data. If it's not, create new record in List 2 with List 1 data. The problem I have is when Get Items return empty records from List 2, it return errors shown in red highlighted. 

Flow error 1.png

and I use

Flow error 2.png

 

Would anyone please share with me your knowledge on how to resolve this issue.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Hardesh15
Super User
Super User

@lechrisvan Please put you condition out side Apply to each 2. Better use one compose after get items 2 and create length function then use condition and when you will pass ID in update item it will apply loop only to update item action.

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh /Gopenly.in

View solution in original post

7 REPLIES 7
abm
Super User
Super User

Hi @lechrisvan 

 

Try to use the coalesce expression where you can default the values for nulls.

 

Please see this video for how to use Coalesce expression.

 

https://www.flowjoe.io/2021/04/30/power-automate-functions-coalesce-handle-null-values-from-objects/

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
Hardesh15
Super User
Super User

@lechrisvan Please put you condition out side Apply to each 2. Better use one compose after get items 2 and create length function then use condition and when you will pass ID in update item it will apply loop only to update item action.

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh /Gopenly.in

View solution in original post

lechrisvan
Regular Visitor

Thank you abm for such quick response.

The issue I have is not Null Field. It's rather empty record return. I tried to use the function empty(body('Get_items_2')?['value']) and it also returns the error. Do you have any other hint?

Thank you.

Thank you Hardesh15. I tried your suggestion but it did not work either. A query for List 2 must be executed for each List 1 returned record. It has to validate whether the same record of List 1 exists in List 2.

Any other suggestions?

Thank you.

Hi @lechrisvan 

 

What error are you getting? Could you please post it?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
lechrisvan
Regular Visitor

Hi abm,

This is what i got for the empty record. The error message appears very blur. 

Flow error 3.png

Thank you both Hardersh15 and abm helping me on this issue. The problem was my looping. It took Hardersh15 suggestion but did not do it properly. I revised my design again and it works as shown.

Flow error 4.png

Thank you.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,232)