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

Check if id matches in sharepoint list when pulling rows from SQL Server.

Hi Guys, 

 

I am trying to run a flow that pulls rows from a sql server table, checks if the row is already added to a sharepoint list, and updates the row if it already exists, and creates the row if it doesn't exist, Here is what I have tried:

scrosb_1-1620349057287.png

 

 

In this case the title in Sharepoint is populated with the ID. What do I need to put into the condition box in order for the flow to run correctly? is there a better way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Mira_Ghaly
Dual Super User
Dual Super User

@scrosb 

I suggest another better approach as below:

On the GetItems you add a filter Query:

Mira_Ghaly_0-1620361223882.png

This will return records only in case the Title of the sharepoint list exists with the SQL ID

Then you check the length of returned records if greater than 0, then records exists and you need to Update ; otherwise create

Mira_Ghaly_1-1620362139500.png

Expressions for 1& 2:

length(outputs('Get_items')?['body/value'])
outputs('Get_items')?['body/value'][0]['ID']
If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

View solution in original post

2 REPLIES 2
Mira_Ghaly
Dual Super User
Dual Super User

@scrosb 

I suggest another better approach as below:

On the GetItems you add a filter Query:

Mira_Ghaly_0-1620361223882.png

This will return records only in case the Title of the sharepoint list exists with the SQL ID

Then you check the length of returned records if greater than 0, then records exists and you need to Update ; otherwise create

Mira_Ghaly_1-1620362139500.png

Expressions for 1& 2:

length(outputs('Get_items')?['body/value'])
outputs('Get_items')?['body/value'][0]['ID']
If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

Thank you so much, this worked perfectly. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,194)