Update a secondary SharePoint list using Flow

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
everyone this is Daniel and in this blog I'm showing how a workflow that could be built in SharePoint designer can actually be rebuilt in flow as well so let me take you to the example I have in the site over here I have a parent list and a child list and what happens in the parent list is users can come in and add new entries for the make and model that they want or either a new user or an upgrade and what the chef would SharePoint designer I could do a look up and compare the model with the child list and if there was an existing model already available I could go ahead and subtract the keyboard and mouse by one and that way I can keep a running tally on how many accessories I have left in the inventory that is something that could be done in SharePoint designer and in this blog I am going to redo that using flow so let's take a closer look at these lists in the parent list I pretty much have the out-of-the-box ID and title column and I've also added two new columns which is the make and the model and these are single line of text so as you can see there is the make in the model and they're single line of text the title by default was required so I just left it as it is but you can make that as and uncheck that the second list is the child list and in the child list again there's the title which is the out of the box but I added the module the keyboard and the mouse so let's take a look at the list settings over here the model is a single line of text and then the keyboard and mouse is a number value but there's one critical piece of information you need to know the model has to be unique in that list and therefore I'm using this enforce unique values radio button over here we want to keep all the models unique that's because there is a look of that is happening from the parent to the child and because of that the items in the child have to be unique and so that's why it's very key that you have you know that the unique value radio button selected so this year is an overview of the SharePoint list and so now let's go ahead and look at how we're going to build the flow so here I am now in my flow I will go in and start building okay so let's go and create form blank call this as a flow demo we need SharePoint and when you use when a new item is created I make sure that I have the correct connection or SharePoint Online I usually go and check to see if any of my existing addresses are already here but they are not so I'll put in a custom one when you have a copy here I'll just paste that in now that I have my site I should find all my lists and I do so the when a new item is created I am going to use the first list which is the parent list so that's the first action over here in the next one I want to create the get items action all the steps on the new step and create add items again it is a SharePoint action and over here I'm going to use the SharePoint get items same thing over here the site will be use Eames make sure I've got the correct connection and let's see you can have my site a dozen so we go and make sure I put that back here and here I will put in the child so that is step number two now we are going to go ahead and add the next step and over here I'm going to use in more apply add and apply to each that's the new action that I'm going to use and over here by default you only have these two value options but you want to make sure that you select the value from the get items that's key just make sure you don't select the new items you want to select the value from get items so I put that over here now on the inside this apply to each I'm going to add a new action and here you can go ahead and simply search for compose and that's the one that I want is the data operation composed so double the same select that okay so here we are going to go ahead and now type in a function but here's here's the key thing over here you have to make sure that you type in but even I can start typing in I do get all these dynamic contents available I do not want to use those you make sure that you type everything in that's one thing second thing is for me I am going to report to a certain column in that child list and that column is the keyboard column because here is where I'm doing the math the math is I want to subtract the existing value of keyboard by one so that's the calculation or the function that I'm doing over here but it is actually critical that you know the original value or the original column name so let's take a look at that I'm going to go back to my list I'm going to go back to my child list in the child list I'm going back to the list settings in the list settings I am going to click on the column itself and away here up in the URL scroll all the way to the back or all the way to the end and you see that the field equals that is the value that you want and you want to take the exact copy of that that's what I'm going to do and copying that exactly over here copy it I've even got a notepad over here something you guys can do as well and I'm going to paste it it is absolutely critical that you get the exact value which you have over here it's in my case the keyboard was uppercase K so I'm just taking that upper case if it was lower case take it I would have made that lower case basically take it as it is some of you guys may even have the percent twenty go ahead and take that as well because that's what you need for that but anyway in my case I made sure that I got the exact value and I kept it away here so now let's go back to flow because here is where we are going to add the subtract function so let's type that in first in the notepad and then we'll copy and paste that here so this is how the function is and it's again absolutely critical that you follow the steps so first I'm going to put in these double codes then I put in the act then I type and sub or subtract open brackets item open brackets close brackets question mark then you put the first bracket single codes and I'm going to type literally copy everything that happens here case two the way here and make sure there is no blank spaces whatsoever single code close bracket comma and then the value I'm going to use to subtract it in this case it is 1 sum that's all I'm doing when subtracting by 1 so I'm putting in 1 over here close brackets and then the double codes so take a good look at this I've added this also to be the blog but it's critical that you exactly see what I'm doing is I'm typing in once again the column name which is exactly the primary column name and we found that column by going to the actual list now I'm going to copy that I'm going to paste it over here just to make sure everything is good once again yep that's good again I did not use the dynamic content that's available over here I actually typed it in okay so let's continue the next step is now again in the apply to each I'm going to add a condition and here's another critical step what I'm basically trying to do is I'm trying to look up the same model from the parent list and compare that with all the modeling child lists so in this condition on the left side I am getting the model from the when a new item is created this is critical you need to know where you're getting your dynamic content from so again on the left side of the condition I'm getting the the model from the when a new item is created let's go and get my model model I'm going to keep it as it is which is equal to on the right I am going to get my value from get items so here I go and look at the model and that's basically it now it can be confusing if you just look at it right now because looking at if you don't know where this comes with a new item this comes in the get items you really can't see that when you look at it this way which is why it's critical that when you're selecting it you know you make sure that you get the correct the value if it's from the new item of the get item that's where I wanted to make sure we walk through that so now that the comparison is done in the the condition I'm saying yes if it this matches but the models match that's a yes so my action is going to be to update an item in the child list so again I go back over here go to SharePoint in the SharePoint I select the update item scroll down a little bit update item and the same thing over here I just make sure that I've got my correct connection I'll enter the value manually just get that link he said I am updating the child list so let's do that and now the unique identifier again the unique identifier I'm getting it from the kit items so I select that as it is same thing for the title that's also coming from get items so I said select that option over here you can add the model it's not you know mandatory but I'll just go ahead and add that as well again that's coming from the get items because that's what I'm going to update that and then finally for the keyboard I want the calculated value so when I select that over here I'm going to use the compose or output to that test that is the variable that comes from this calculation that you've done so that's that's what I'm doing that's the compose and that's the output over here and then the final action is not mandatory but I'm going to do that for the sake of this example is I'm going to just add a email alert that just lets me see what these values are so for that I will use my office 365 outlook and I'll send an email and send an email I am putting in C the email goes to were created they are created by email subject I'll put in test testing lo demo and the body I'll just put in some information so let's say model and the model I am getting from the update item then I'm getting the keyboard and in this case the keyboard is the count of the keyboard and for that I get in the output once again let's just confirm that for the model I wanted from the get items model let's just make sure I put in the correct one that is it so here's a good way now to see that if everything you put in is actually correct and designed and the best way to do that is basically click on create flow because if there's something which is not track by design you know which flow doesn't like then this is where it'll tell you that and that's also a good way to confirm that what we typed in this function now even though we typed in everything manually but this is exactly how flow wants it and so it didn't cause any error so I'm going to now go ahead and click on done it gives you this new view of what the flow demo is it shows the connections you have a way here who is the owner and right now we haven't run run it yet so that's why the flow history is a pinke let's go ahead and now do some testing so me as a requester I'm going to go ahead and say yeah I think I want and aspire you so that's what I'll do I'm adding a new item say I'm testing or low demo make I'll put that in as aspire issues actually and the demo that I put in was the the model I'm putting it as far you I'm going to go and save it now there is the this I put in the new item the floor will kick off and if everything goes well it should go ahead and subtract this value from 100 to 99 so let's go back to flow and take a look and we can refresh that over here [Music] I see that the first slow just ran and it is exceeded so let's take a look at it okay I got an email over here so that's good but let's take a look-see hello sometimes it gives the great ID for the list name that's fine we'll leave that as it is hey it did the mat it actually went ahead remember the original idea value was 100 but it subtracted that 299 which is fantastic and now because the condition matched remember that model which we had one getting getting pulled them from the parent list and the other one getting pulled from the child list that matched and it's yes so it came over here it went ahead and updated and it did the correct update because if you look at even the body over here it is pulling the correct model that's what we typed in the Aspire and this is the model and this is the information that's coming in from the child list the original value was one so it did that and it subtracted that by the original value 100 but it subtracted that one and gave me the 99 and then it sent me an email let's take a quick look at that email says yep that's the model and that's now the current keyboard value and now if you go back to that list if i refresh it this hundred should change to 99 and that's exactly what happened the flow took care of the subtraction and it really replicated what can be done in SharePoint design as well I had the constant that I had between the parent and the child is this model the models over here match so since I have something that does match I could use that to relate the two lists and I could do the subtraction so that's basically how you can replicate something that could be done on SharePoint designer can also be done on Flo this is how you do it here's the video and I've also provided all the screenshots and details in the flow blog over there and so hope you enjoyed this and hope this guy's hope this helps you in some of the future flows that you guys are building
Info
Channel: Daniel Christian
Views: 47,764
Rating: 4.9340658 out of 5
Keywords: Flow, Microsoft Flow, SharePoint Lists, SharePoint, SharePoint Online, Workflow
Id: QV3-lerjpus
Channel Id: undefined
Length: 18min 15sec (1095 seconds)
Published: Fri May 26 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.