Power Automate - (Community Thread) - SharePoint find duplicate list record and change status.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi let's have a look at this Microsoft power automate Community thread so the title is find duplicate and update status value to duplicate item so this is based on a SharePoint list So the plan is user is going to create a new item then find the duplicate and then if it's duplicate then we need to set the the latest one as duplicate okay so I made a SharePoint list which is similar to this let me show you that here is my list called test list so if I add a new item so I'm going to put 100 there title is 100 and see the status ignore or ignore the other columns here please so um I'm going to default to new and if it is duplicate then we need to set that as duplicate record yeah so it's new and save it so the next record if I'm going to create another one with new then in theory what should happen is once the user saved this is the latest record so this record it should set to duplicator core okay so ideally that should show that as duplicator code the other one other one will be the default status which I am using here as new then okay so let me delete all this and um we can test this dot so first um let's build the flow so for this I'm going to use the SharePoint connector as my trigger so SharePoint when an item is created okay so here I'm going to select my SharePoint site then my list name is called test list so you can type it here then it should appear here test list that is okay and the next thing what we want is we want to find the duplicate so for that I'm going to use get items okay here we go get items and again selecting the site name then the same list if you want so that's um test list okay now the next thing we need to do here is we I'm going to use my identifier as title so remember I'm going to enter here the title as numeric values here like 100 200 whatever that is yeah so um to get the schema name always you need to go to the list settings and click on the title then see here free legal's title so that's a field in name we need to use the reason I'm saying here is you can rename this to whatever you want you know I can call here as number or unique something like a number or ID or something like that I can call whatever I want but this name is not going to change so always use this name under your filter correction okay I'm not going to rename that I think it's a useful tip to know actually okay so that's called the title so I'm going to type that field because that's access given name is equal to the title coming from the previous so two single quotation within that I'm going to use this title then okay so that's that then the next thing we want to use uh do here is we need to update the duplicate so I'm going to use an update item and then and then the SharePoint site name again it's the same thing called test list test list okay the ID so remember to update the ID we want the actual ID which is originally created okay then only we can update a record so the ID is coming from the when an item is created or from the get items so remember the requirement here is the latest one we need to set that to the the latest value we need to set that to duplicate yeah if it's duplicate if it's more than one record so that means it's always going to be our when an item is created so that's that when an item is created that said id I'm going to use so remember that that's coming from the trigger that's going to be the latest record then inside the title because it's mandatory again I'm going to use the same title as the previous one um you know from the trigger again okay so once they're done what oops sorry the title I need is um I need a title coming from the oh no ignore the apply to each Loop let me add that again okay so update item id then the title coming from the so let's search for the title when an item is created so it should be the same same one now yeah okay so the rule here is we can only update the status to duplicate this if more than one record there so for that what we want to do here is I'm going to add an action step and an action so that's um and if if a statement I'm going to do and I'm going to say the if condition here and in the condition what I can do here is I can get the expression here go to the expression and to find the foreign and type the length plus Escape key so that's expression you typed place your cursor inside that between the brackets then click on the dynamic content then here I'm going to select get items value there see that value so that's that's just that's the syntax we want so here here we go I'll copy this expression under my video as well so I'm going to add a note so you should know that what it is length output of that that will make sure if the record is more than one or not so I'm going to put here is greater than 1 that means there are two records here yeah so if it's greater than one means it's guaranteed that we got two records and the very latest record we want to make it to set it to uh you know um to update yeah so I got that now then here we can go here and say update but we can't and just drag and drop that under the S condition that the update statement so in theory it should update it but there is a problem here the problem is the length is greater than one we want to get only the latest one only okay then the latest record only we want to get um to say yeah we want to update that to set it to duplicate so what I did here is I'm getting the get items that will give me um you know more than one value or not then I make sure that this side is coming from the trigger ID and this is my title also that is also coming from my trigger which is the latest record so only the latest record is going to get updated and then it set the status to duplicate record okay so I'm going to save this flow so SP less duplicate status okay so the next thing I'm going to do is I'm going to test this yeah right click on the test add manually and click test this is one way of you can test the flow immediately so once I click test what will happen is the flow is going to prepare for that trigger now yeah you see that it's waiting now so now I'm going back to my SharePoint and adding a new list here so adding a new record I'm going to use 100 status is new here and click on Save that's my first record so let me go back here and within few seconds the flow executed so let's go back to the Run history the flow created successfully and then so sorry the flow runs successfully the get the items it is looking for the title is equal to 100 which this 100 values coming from the previous step it shouldn't be so it is false it's only one record there so it's false and it's it's not going to update it so if I go back and refresh this screen again still my status will be called it will be you know new then okay the next thing I'm going to do here is I'm going to add another call again 100 again okay this is a new one new the latest one I'm going to put and then um that's again I'm going to save this so let's put something here as a project um number as something hundred so at least I know that's the new record I added because otherwise it looks pretty much similar so this is the latest record you can see here that's also new but let me go back to my flow now click on the back button and yeah keep refreshing this this is a refresh button so anytime flow should run again and let's see what happens okay here we go fluorine floor is running now and let me first start that succeeded so let's click on that so this is another way of looking uh the Run history what happened this is the latest around this is my second record which I created then the flow you know started running then install seconds ago so I'm going to click that that takes me to the flow run history that's the record has been created then the geta items and it's 100 so there are two records here so it's true now see that it is true now and it is updating that item ID is 23 which is my latest record of the ID it is so if I go back here under the when an item is created this record ID is 23. if you click on download that will open up this window just search for 23 here you should be able to see it 23 is ID here so where is it see that internal ID and the ID is 23. see that that side it is so that means it's updated that latest record with that status which is setting the status as duplicate record okay let me click on the back button now go back to SharePoint remember I'm not refreshing that ad oh yeah it's automatically refreshed so the latest record it is see the latest record which I remember I put under the project number as 100 also so that's it to duplicate record so from here what we could do then is believed in in this thread and then it says if duplicator study is found update the most date time status value update the most current date time item status value to duplicate item um that is the that is what I just showed then send an email to the manager saying duplicate form so all you need then is under the if condition after the update you could go here and say send the email and then put the appropriate message and send the email that should be under the as condition of that after the update item okay I'm not going to show you that I'm just you know looking that thread what's the requirement here is so yeah that's the way you know you can um you know do the updates finding the duplicate and set the related status so um again I'm going to add another one you can add another one also and um I'll see you know you can again add here under if you want and then put here the the project number I just want to you know set something there actually and let me see that project number yeah I'm going to put 100 dash uh two then you know just know that this is the third record so 100-3 then yeah and save that here we go that's the latest record it's new now and just going back to the uh you know the flow and um just click on the refresh keep refreshing it and see under the floor run successfully okay flow run successfully and I'm going to click on the history again you can see here if again it's you know looking for the same value 100 there because that's the value I ended as the latest record and then it's true then and it's update the record and you know it set the status again there so let me go back to SharePoint here we go that's the latest one I entered like 100 hyphen 3 and that's also such as duplicate record if you look that's the very first very first record we ended and that is still showing this what are the status it was that in my flow I set the status as new then that's it yeah I hope this is useful thank you for watching thank you
Info
Channel: abm abm
Views: 3,499
Rating: undefined out of 5
Keywords: Duplicate List, Flow, PowerAutomate, SharePoint, Status
Id: k30iiYlokRc
Channel Id: undefined
Length: 12min 51sec (771 seconds)
Published: Wed Mar 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.