🔃 Sync two SharePoint Lists: A Quick and Easy Guide

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi welcome back have you ever had the need of syncing two sharepoint lists with each other let's say we have one master sharepoint list and then you have another one and every time you write something on the master sharepoint list you want it to be reflected on another list know where other people are working i've had to this scenario once or twice in my career until now and it's an easy fix it's quick quickly done as well and i just want to share it with you so let's take a look how it works as you can see here i have a list number two and at least number one i've already tested it a little bit so that's why you can see some data and if i'm going to create a new item in the first list let's say title will be titled in this case is first name which is test user you can imagine other columns and other data of course last name uh test user last name i don't remember any random name so i'm going to use such uh phone number blah blah blah country is let's say france city paris and let's save that so now my workflow is going to check in the second list if we have that data already there or not and if not it's going to create it so now my workflow should run and as we can see the test user popped up in our second list so what i'm going to do now is i'm going to change the information around first name and last name for the from the first list and we'll see what the workflow will do in the second list so let's grab the test user and let's say test user tool and let's say here also oh it automatically saved so that's it with my test for now let's let's see that first and let's see here it should check that my test user already exists as you can see and it updated automatically only the column that i changed right so um yeah that's that's how it works and um i imagine you will need this sometime if not already and i'm happy to show you how to do it so stick around give a thumbs up if you like the video and yeah make sure to subscribe [Music] okay so here we are let's create a new list and i'm going to call this my master list and i'm going to select create don't mind if it's in german sorry but you get a point so the title will be let's talk about cars this time not people let's make this our um car model we can use a space here since it's already called title and backhand it's not going to mess up with the naming um let's put here another column about the color and let's have another one about the engine another one about built here obvious how you called it and i'm not going to put put a space here because um as i said now in the back end then it will have to encode that uh decode that space so you end up having like percentage and and d or such such uh encrypted uh characters so i will put build here so that in the back end ends up being the name built here then i can i can put a space in between so that i can have the display name of the column the way i want it okay save let's get another one and this will be type like coupe or limousine or sedan and so on and so forth let's say car type okay that's enough i think um so what i need to do now is i'm going to go to my site contents and i am going to create a new list based on my existing one huh so i don't want to type the columns again in this scenario you have to uh we are we're recreating the the master list somewhere else for example and um we are going to use the same columns so this is not a muscle this is this is the second list same scenario here if you use uh blanks you're going to have um not that clean url so that's why i'm writing this way and we can rename it later on click create and oh it looks like my english i switched the language actually yesterday but it somehow took ages to activate so it looks like now it's in everything english so we are good there as you can see we have on our second list now we can go on and rename this because in the url we have the right name or it looks good so the display name of the list now it's going to be second blank list okay so now we have our second list and for now if we create one in the first list it's nothing going to happen here so i have already opened my uh power automate and i'm going to create an automated cloud flow this will be my list sync flow and i want when an item is created or modified trigger create okay so now i'm going to grab from my development environment my master list and this will now trigger my flow next what i want to do is i want to go to my secondary list and get the items from that list before we do that we need to filter the get items based on the id of the same item which is in a muscle list so for example if i create one item here this is the demo that i just showcased this is a list number one we have the id which is automatically created i want to save this id in the second list so that i know that this item is the same with the other one because if i use there the default id column those ids num id numbers can be different so i cannot rely on that that's why i'm grabbing the id from the master list from the number one in this case and saving it in the second list as my um as my singles id so if we see here in the second list i have a column called synced id and this is the id coming from the first list so this we have to create again okay so this is the second list we need to add a new column here um i'm going to do text you could do it in whole number it doesn't matter actually and um this will be my synced id from the master list so i'm going to bring this column at the beginning and so that you if you want to have this column online always at the beginning you can either customize the view by switching the numbers no you know with the checkboxes number one two three which column has to be the first or you can just drag and drop them but then you have to go here and then save the view as uh all elements in this case and then this will uh always keep the um the columns in the way you sorted them now okay so now we have the synced id in my power automate i don't think it already has that so let's delete this get items and do it again get items and i want to grab my development team list name is my second list and i want to filter my query so i want the id of the trigger outputs which is from when an item is created modified to be equal eq is for equal the synced id column which is this one here okay so this should do a trick okay before we save it let's go to the master list and create one or two data entries i'm going to edit in grid view car model bmw color black engine 2.0 i um i don't know birth year let's say 2018 car type uh coupe let's do another one this will be a series gray uh 2.0 uh cdi once i remember the old diesel i don't know how they're called now anyways uh 2015 it's a sedan and that's that's enough for now exit grid view we have some data that should do the trick so now let's test the um get items here when an item is created or modified now let's save this and let's test it manually test okay my workflow now is now waiting let's modify the bmw and let's do from black to uh red okay workflow is working uh it didn't find anything of course now in the second list that's why this is empty and now what i want to do before i test it again is i'm going to copy this entry and paste it in my second list from here and the synced id i'm going to manually put it now is imagine number one let's check it out because this is how it's going to work at the end now you're going to create items here and it's going to create the synced id and everything by itself but for testing purposes i'm going to make it now manually exit grid view i want to have in my master list also the id column for that reason i'm going to go and edit the view because id column already exists there it is and let's put it at the top okay as you can see bmw has id number one in the second list as well that's the synced id so now if i run this again with uh manually because i'm afraid if i run it automatically with the last run i'm not sure it's going to grab the new entry here so i'm going to modify bmw to be built here 2017. and let's see so now it's triggering the workflow it's grabbing the data from the second list as you can see here it worked and we have the one equals sync id because that's the id of the item i modified in our master list click to download and it looks like we have some data i know for people who follow me on linkedin i discovered a very cool tool a couple of days ago it's called json crack and what i'm going to do here i'm going to paste that information into this tool and as you can see it visualizes me that json this is the output from my get request get items and we have here the headers and the body i'm going to close the headers and if i move a little bit to the right we have the values so for now i have only one value because only one item was there and that's why it's showing it here but otherwise it should it will show it below each other which is very helpful to understand what data you're getting so this is working what we are going to do now is we are going to add a condition there it is and in the condition i'm going to check if the length of my dynamic content value which is a list of items we can see it here as well not here but in the json crack tool this is the value now we have here the response code this is the body and then we have the value and these are the values so that's what we are checking now that's why um go with a value and not with a body so as you can see here length of the outputs from the get items we're going to the body and then the values grabbing the values now click ok and then it's equal to zero now because it's going to return an integer number and we're comparing it to zero so if it's zero then it means that the item does not exist so it will go yes path and we need here to go and create an item create item in our sharepoint list where the data is going to be created which is our second list is going to load now our um columns the title is the car model so we're going to search here for karma no sorry it's called title as well in this in the first list so when items create are modified that's our first list master list and that's the title that we need the sync id is the id of the same list the color as well from a first list engine here as well built here also from the first list and the car type okay so this is now going to create the item but what happens if it already found an item so we want to go here and say update item update item there it is we are going to find our site address and our second list and now we are going to encounter here a slight problem if i select the item that i'm going to edit because we are not going to edit the item with id from the master list because now we are not looking for the synth id we are looking for the internal id no so in the second list we have the synced id and also the internal id which you cannot modify it's always there and it's how databases work but since we're in sharepoint let's call it that way so this is also a mandatory field otherwise sharepoint and flow cannot find that item to modify if i go now and select id since we are doing a get items get items is assuming that you're always going to get multiple items for that reason it is creating an apply to each our workflow will run every time an item is changed so uh we can leave you this way it's only going to run once it's not going to be an issue but um i can show you another way as well so you can skip the apply to each loop so to remove the update item now from the apply to each loop you need to remove the value here and the id from here and then you can drag and drop it below and then delete it or you can do the whole loop since we're not haven't inserted data yet it's not a problem um so to do so i'm going to write an expression give me the outputs of get items this is from this step here question mark square brackets then we go into the body of our response and then on the level value then we are going to write the index of the position of the element in the array now since we're retrieving an array back uh arrays is our list with data or it's a string it's a list with data which has a list of data and each data has a position and it starts with 0 1 2 3 and so on and so forth so since we're grabbing the first one we want the position 0. and in that position we want the column id so we need to make sure that this columns here and also this one are into single quotes the index of course not but this one needs to be select ok and this should be entered now in our field here the title is as well required title is going to be the same now from what was triggered in the master list so now we don't have the loop anymore because only the id was coming from uh its own list or it's not coming from there but it's it will search there but it's coming from the get items everything else the data that we're going to update will come from the muscle list which is not going to create loop since it's only one item so we write title there the sync id now is the id from our when an item is created or modified from the master list we have then the caller it's now everything is similar to the create item engine built here and car type oops sorry i forgot here to write underscore no blanks right so let's update that and select save yeah there it is select test manually let's test it out so now i'm going to go to my master list and create a new item let's have an audi it's uh i don't know blue color engine is a 2.5 liter tdi um birth year is 2015 car type is done as well safe flow is running hopefully and it ran successfully it did not find an item without id so it went on and created that item so we have now in a second list maybe it wants to be refreshed and there it is audi it's blue it's that and it's this so now let's test it again manually actually it's an automated cloud floor you don't have to test it manually but i think it runs faster when it's expecting for a change um yeah when you use it daily you don't have to do that of course so let's modify audi and audi it's not 2015 anymore but it's 2016. click away it will save the changes my power to medflow is now waiting for a change and it got it and now as you can see it's not creating the item anymore because it found it and it's going to update that item so the update is 2016. and we can see here that the year has been changed to 2016. yeah that's it i hope you liked it and i hope you can use it sometime and um i think it's a pretty neat and very easy to implement workflow and can be very handy and helpful for very different and use cases and scenarios so make sure you like the video if you did so make sure to subscribe to the channel and hope to see you soon cheers [Music] you
Info
Channel: Enea Liçaj
Views: 33,129
Rating: undefined out of 5
Keywords: Power Automate, Power Platform, SharePoint, Wondershare Filmora, json, microsoft, microsoft flow, microsoft power automate, microsoft power platform, power automate sharepoint, power automate tutorial, power platform fundamentals, power platform microsoft, power platform tutorial, power platfrom, sharepoint lists, sharepoint lists tutorial
Id: looyVm_8OKI
Channel Id: undefined
Length: 22min 22sec (1342 seconds)
Published: Sun Sep 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.