cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
naijacoder
Helper IV
Helper IV

I need a flow to check if item already exists in SP list - if not create and if yes update the item

Hi All,
Just getting more into flow and need some advice and help :-
I have 2 lists that i would like to keep synced.
So when an update happens in List A i need  List B updated.
If item already exists in SP list B don't create a new item but update the current item  with the fileds from list B.

Why i want this is because i don't want to have duplicate records in List B if they go and make changes in List A.
Can ths be achieved using flow?

Thanks in Advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @naijacoder,

 

If you want to synchronize two lists, you need to have a column similar to the primary key. If your two lists are identical, then the ID can be used, or other fields have the same effect.

I use Title as a column like this to give you an example of Flow configuration.

13.PNG14.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
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 @naijacoder,

 

If you have solved your problem, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best Regards,

Barry

Community Support Team _ Barry
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

22 REPLIES 22
Pieter_Veenstra
Community Champion
Community Champion

HI @naijacoder,

 

I while ago I did somehting similar where I read an excel and kept a SharePoint list in sync.

 

 

v-bacao-msft
Community Support
Community Support

Hi @naijacoder,

 

If you want to synchronize two lists, you need to have a column similar to the primary key. If your two lists are identical, then the ID can be used, or other fields have the same effect.

I use Title as a column like this to give you an example of Flow configuration.

13.PNG14.PNG

Please take a try.

 

Best Regards,

Barry

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

Thanks Pieter
Will give it a shot

Thanks Barry and Pieter  i gave it a try but and it works well if true and sents an email.
But if its no it doesn't get to send an email :-

Send Email 3 doesn't do anything

Capture.PNG
 

Also see the result output below :- (Can you see the highighted as its greyed out)

Capture1.PNG

Thanks in Advance

Hi @naijacoder,

 

The condition set in Condition means that if the item does not exist, the mail is sent.

If the condition is False, the value of Get items is empty, so Apply_to_each will not be executed. You should not configure the Dynamic content of Get items output in the Body. Because this item does not exist at all.

If the item does not exist, you could consider creating such an item in list B, and then configuring the Dynamic content output from Create an item action in the email body.

 

Best Regards,

Barry

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

I would remove the dynamic content form your Send email 3 action.

 

Then pull the action outside the apply to each. and delete the apply to each

Thanks Barry for the reply.
If i don't configure the dyanimc content in the body @equals(length(body('Get_items')?['value']), 1) what should i be using then?
i would try creating an item on another list if the item doesn't exist and see how i go

Hi @naijacoder,

 

You could configure Create item before the Send email action, and then configure the Dynamic content it outputs in the email body.

Image reference:

26.PNG

Take a try.

 

Best Regards,

Barry

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

Thanks for your reply. and will give it  crack
I also just noticed there in no "When an existing item is modified" trigger"
There is only When an item is created or modified 😞

Can i achieve my trigger only on update and not on create? Is Microsoft going to have this or is there a workaround?

 

Thanks in Advance

Hi @naijacoder,

 

Yes, there is currently no trigger like When an item is modified.

Specific details can refer to this Thread.

In addition, if you just want to monitor whether an item is updated, you could set Condition under the trigger.

If Created is not equal to Modified, execute the following action, configure all the following actions in If yes branch.

Like:

31.PNG

Take a try.

 

Best Regards,

Barry

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

Thanks Barry I taught as much and would give that a try
Also not sure why my other fileds are not updating. The title fields get updated but not other fields higlighted below which is just a text field Employee (name) 

Any reason why this could be happening?

Also tempsnip.png

Hi @naijacoder,

 

You need to fill the Dynamic content of the trigger output in the field that needs to be updated, instead of the Dynamic content output by Get items, otherwise the update will be meaningless.

 

Regards,

Barry

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

Thanks Barry.

Not sure what you mean but i have only this 2 options below.
As i mentioned currently the title field is being updated

 Capture2.PNG

Thanks Barry your response regarding  "trigger for When an item is modified."

I couldn't find to pick created and modified from the dynamic content not sure why.

When i manually added it i get this error below:-

 

The template language expression 'not(equals(triggerBody()['Created'], triggerBody()['Modified']))' cannot be evaluated because property 'Created' doesn't exist,

Hi @naijacoder,

 

I mean the fields that need to be updated, populate the corresponding Dynamic content from trigger.

And the fields which do not need to update, populate the Dynamic content from Get items.

Could you share the all options for your Dynamic content list? The action output on the list item will basically have "Created/Modified", you could look it up carefully, click see more to see if it is hidden.

Or it is not so expressed.

 

Best Regards,

Barry

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

Thanks Barry.
Still quite new to flow but weill get there...
The mistake was the view i was selecting under the "Limit Columns by View" 😞
Now i that selected Use all Columns(Do not limit) i can now see created and modified columns

I have also been able to select the correct value for the update in the dynamic content.

 

Thanks so mcuh

Hi @naijacoder,

 

If you have solved your problem, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best Regards,

Barry

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

I am trying to use Flow to meet a user's requirements to:

1.  copy new items with attachments in List 1 to with attachments in List 2

2.  Update changes made in List 1 to List 2 in the same site

 

Setup:

2 SharePoint list - List 1 and List 2 with same columns (text, choice, metadata).

 

I created a FLOW using 'When an item is created or modified'.  

 

Result: 

1. requirements met

2. when a user updates a column in List 1, a brand new item is created in List 2.  If a user updates the 3rd time, a 3rd duplicate item is created.

I have been trying to add 'Condition' to part of the Flow but it did not work. I noticed that 'Condition' does not have 'Edit in advanced mode' but with 'Add' only.  I wonder if this has to do with the version of SharePoint online.  I cannot make requirement to work.

 

I searched a number of forums but I have yet been able to meet requirement 2. 

 

Thank you for any help.Condition_AdvancedMode.PNGCondition_AddOnly.PNG

Hi @v-bacao-msft 

 

I have a similar problem but with the SQL connector. I want to check if one row exists in a table, I used the following expression:

equals(length(body('Get_row_(V2)')?['Value']),0) (  with no @ at the begining of the expression), but it doesn´t work, the error shown is:
error1.jpg
and the part of the flow that doesn´t work:
error2.jpgI also changed ['Value'] for the primary key of the table ['Ticket ID'] but it still doesn´t work, it returns another error message. 
any help will be appreciated.
 
Thank you in advance.

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (3,189)