SharePoint Power Hour: PowerApps Patching

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone I'm Laura Rogers welcome to Power Hour and we help have joelle drops in here on audio say hello hello everyone welcome if this is your first time Power Hour is a weekly show we've been doing for a few years where we just talk about out of the box things that you can do in SharePoint office 365 and we're not programmers we don't talk about anything super complicated we kind of like even if it is complicated we try to break it down and make it so that this is more geared towards business users so Wednesdays at 11:00 central we try to have it every Wednesday 11:00 at Central whenever we can but so today's topic is going to be this concept called patching in power apps and so power hours very informal we just kind of chat as we go and I make up stuff as we go most of the time and if you are looking at this in YouTube actually I forgot to let me go ahead and stream to Facebook - there we go power ups patching sorry about that all right so if you are watching you can see in YouTube there's a link to join the discussion so there's a link if you've joined already you can go to iw mentor.com and just log in there and that's where we're having our chat and the little power our channel in there and that's the whole fun of doing this as a live show so that we can have questions and discussions and never know what's going to happen and then for those of you have never joined before there's also a link in the in the description and pout and YouTube to fill out the form to request to join so alright let's go ahead and get started so we're going to talk about patching first of all what is patching patching actually existed in power apps before the concept of having a form control where you just do a submit form so patching is the way you submit you can submit data to whatever your location is like like SharePoint like people filling out a form and clicking submit or clicking save and the data goes in so that's that's the concept patching is just more complicated than it is to just use a submit form function it's a little more involved so when they came out with a submit form you know people mostly use that because it's just easy and simple but let me go ahead and share my screen and I've got like two slides this is an excerpt from our power apps class that we teach and let me see I can't get my toolbar to get out of the way here all right he's in the screen I think so there we go okay patching is a way of updating or adding rows of data either to a data source like a SharePoint list or to a collection patching can be used instead of submit for my patch why would you want to do this if it's more complicated than just submitting a form well when submitting a form isn't enough and you need to do something more complex than patching so if you a couple of examples if you need to dynamically update or change data in other fields similar to actions that had previously been done via workflow so like if you're clicking submit and you want to say well if this condition then set the status to submitted otherwise set the status to in progress or you know so you can do logic in your patching in your when you're writing out your function instead of doing logic in a workflow I have a project that I recently rolled out just in the last couple of months to where we do every single thing we do all of our logic all of our emails everything is just done in the power app without using Microsoft flow without using SharePoint designer it's just all done with like patching and email the email function stuff like that so that's what that's what it means to patch so let's go to the next slide one more and there's a syntax to create things in a list this is the syntax on this this top bullet point you just say patch you say what the list is for a new item you just put this default thing and then you can say specifically what you want to be in these fields using this syntax with a curly bracket and then the name of the field and then what do you want to be in the field the name of another field what do you want to be in it and the name of the due date field and then it's got like now plus two so it'd be two days from now so you could literally click a button in a power app that would do this in one fell swoop it would go create these two tasks and then to modify an existing item so in this example this would this is if you're in a gallery list of things you can say patch to you know whatever the name of the data source is and then which item are you patching like an existing item and then you can say what you want the value like what what specific field value you want to have in there so you go ahead and close that and then we have this I'm gonna copy this link here over to the chat window alright so here's the link I'll put that actually I put that in the general one so you can get to that readily alright so that's that's where you can find the information about your syntax Microsoft even has like several different examples in here it even has like exact you know things that you can actually try and do and work through it so that's again just like with all of their all their documentation it's pretty thorough so let's go ahead and do an example and show kind of the difference between patching and and submitting a form so I'm going to I've got like all these little messy power apps here where I've just been like trying kind of all these random things but I'm gonna go ahead and just do a new one so we can start from scratch and just have like just this raw empty power app so that we don't get overwhelmed with all the colors and different various things that might be going on in oh my all my little test apps so let's just do I'll just do a tablet blank app and I gotta add a data source so my data source is going to be I've got a list of let's see I'll do a task list and to keep it simple let's see what kind of status of status is just a single line of text and I'm going to do that just to keep it simple so because when you start dealing with people fields and choice fields and look up fields it gets much more complicated so I'm just going to use a single line of text field for the thing that I'm about to show you so this is a list called task list here in this site and where's my new app I just created here we go let me save this I've got so it's a ridiculous number of time tests power apps in here alright so now to save it okay so now I'll go ahead and add a data source and I'm going to use SharePoint where SharePoint there it is and then I just need to say which site I'm going to and this is my very simple task list with just a few fields not using the task list template but just from scratch just a custom list with just a few fields in it so let's show that first of all let's do a form so to show how simple that is so we put a form on here and we connect it to our data and all these fields get added to our form and a lot of these are just all these like system fields that no one is ever going to use that you wouldn't want to necessarily see in here so I usually just go get rid of a bunch of them okay so now it's pretty simple so we even when you use a form control you have it doesn't give you any kind of button to submit it so you do have to go ahead and create one of those now when you do a customized form over in a SharePoint list it does have a lot of pre-canned stuff built out for you but I built this just raw just to be able to see without you know again without having all that pre-built stuff already in okay so I'm going to make this button submit the form and which form I haven't named it or anything so actually better name this task frm tasks there I like to give use a little syntax and rename this BTN submit like that and then I'm going to what I can do is what I can is I can say when I get to this screen when the screen loads then make this a new form but I can also just create a button that creates a new form for me cuz it's not automatically going to be a new form necessarily they're they're different settings and things like that that I would have to put in place so I'm just gonna make a button that does a new form and so what I'm going to show you is just real quick the difference between the way this works and the way the patching works okay let's try that out new task now got a new task form new new Wednesday one sign it to show well and I'm just typing a status remember I made it a text field and then due date I made that a text field too because I was playing around with some stuff earlier I was making sure everything was very very simple and then I don't have any attachments in my using attachments and so what I need to do is I need to go make sure that I don't have some kind of it just gave me an error so I need to go get rid of some of these I've noticed that some of these system fields even if you're not using them not they're not doing anything they will sometimes cause an error if you even if just their presence especially ID I've noticed that about the ID field I don't know if y'all notice that before so Brad to answer your question he said task list made from the template are not supported in power apps you can you just can't you just can't have any spaces in your name of your list so I think I have one actually that I can show you they are supported so like here's a task list called tasks so just I'm just to show real Brad real quick morning my oh there we go if I want to add a list that's using one of those templates and not a custom list or if it's a library I just have to be able to type it in here so you go to weird SharePoint go I'm blind I'm I know I skipped it oh yeah there it is okay so it's not going to show it so if I put my up at my site here see these are all just custom lists but I can type tasks like that so it doesn't doesn't support having spaces in there but I can connect to it so yeah that's possible and same goes for document libraries you can just type the name of it there let's see if this works now not sure what I did wrong this is like super simple okay so that so that worked it was like that name field and some of the stuff that the system fields that were just on there that I wasn't using that we're causing it to have an error for some reason so now let's go to my task list and I can see here's the one I just created and I didn't put a due date in there alright and then okay so now that's just super simple submit form so now let's go talk about like how to do a patch and go we're gonna patch this instead of doing a submit and again just going to keep it super simple and then we'll talk about some other examples as to why you would do different cool things you can do with patching that you can't do with just submitting a form so on select instead of submitting a form can patch and it shows you it's what I love about this is that it shows you what your syntax needs to be task list so that's the name of the list that I'm patching to and then so remember the syntax is if it's a new record you've got to have this default thing defaults and then task list and then you need to say what fields you're patching you need to like specify every single field so then I would go title and you got to know in SharePoint what the field is called so I got a task list settings oh do I need to change my resolution I forgot to change from a resolution and that I usually do um y'all see that okay maybe not let me see see it looks okay oh it does okay all right seems can might be a little yeah fall screens a little fuzzy ah let me just changed my resolution sorry about that I change the wrong liner I need y'all to be able to see this because the way YouTube renders it it's not the easiest okay now there we go with settings okay so you need to know the exact system name so see how when I hover over this at the very bottom of the screen it says field equals title and then I hover over this it says field equals assigned to and then this one says - field equals status field as a due date so those are the field names that we need to use when we're patching if I change this like if I go in here to assign to and I just change it to assigned space - it's still when I hover over to see it's still assigned to one word so that's the system name or whatever you call it is what I need to know when I'm doing these ok so so I go title and then I say I'm just going to type something in quotes and then I'm gonna say status and if so it's up to me as to whichever fields that I want to fill out of course if they're required fields I can't skip over those but then I use the curly brackets so this is this curly bracket section is where I have the different fields that I want to fill in with commas like with this syntax with field colon value comma anyway and then I close out the whole patch and so pay attention when you're writing out these your formulas that when you select when you have your cursor on one of these parentheses it actually shows you the other matching parentheses so it's really nice that it kind of lights it up that way see as you're building things you're able to quickly kind of see what's going on especially when you get these long complicated functions all right so I'll go ahead and preview that new task and I didn't do a reset form so let's go ahead and do that so after I see after I submit it I'm gonna go ahead and do a reset form and that way it will clear out the values so this one I'm going to do now I typed in so in my patch I typed in what the title is I just typed some some text that's hard-coded in there so it actually does not even matter what I type in these boxes because when I patch it it's gonna put what I put in those quotes so let's go see what that looks like let's go to task list and then see a type ii test in that in my patch in quotes and then i put new so that's the value that I got so if I want it to have the values that are in these boxes first of all I don't even need to use this form so that's the first thing to understand let me zoom in a little I don't even need to use a form control when I'm patching mind-blown right so what I can do is let me just kind of show you like just this raw without even using those is get rid of this stuff I just deleted the form off of the page and I can put a text just insert a text box in here and I can put see test name and then this is gonna say I always like to just go straight to advanced I don't want to have a default value in here but I do want to have a hint text like that so now it's gonna say type the TAS name and then I'm gonna say put status in here drop-down and just just a raw drop down and then items are gonna be like doing this table where I can do I don't remember if I'm doing my syntax correct no I think I type that what was my table I think my table syntax has one of these oops I'll have to go look in my um I'll have to go look at my notes as to what the table syntax is I'm just gonna make it a text box for now but yeah so that's that's another one of those things that you can do raw without having to have a choice field and SharePoint that you use as your in your control so you can have just a raw drop-down box where you just type what you want the values to be instead of having to use it use the one that just SharePoint just gives you so let me go get that I've got the word table in here too many times Oh I'll do well I yeah I just let me just look it up real quick come on they have it in here so I pretty much used this this reference for like as I'm working in power apps every single thing and I do oh yeah so you just got to put the curly brackets around each one so that's what I didn't do hold on curly brackets and quotes okay yeah I'm just going to copy that actually and I'm gonna say choice new y'all following me as to what I'm doing right now I'm doing like just this wrong way of doing a drop down they're okay default nothing and then value is choice okay so then I need to have a button that's that patches it but I don't want to patch like this hard-coded this stuff in quotes right I want to patch what's actually in these two boxes so first of all I'll go ahead and give it a better name with that and then I'll give this a DRP status okay so then I want to instead of using this hard coded text I'm gonna put the txt task name that dot text so not just this control but what's typed as text in the control and then for the status I'm going to do DRP status dot selected so whichever one I select dot choice okay let's try that okay so it's submitted it I didn't have it clear it out or anything afterwards but let's go look alright so there see I had just type stuff here in the box and typed in progress all right so that's just a super simple example of how it works thanks you guys for having for Jenn naka says why not just using a ray yeah that's what the table control is right um okay so now let's do a gallery of tasks this is fun okay so I'm gonna go insert a gallery and the goal here is going to be to quickly change the statuses of a bunch of tasks by we're not even gonna have a forum we're just gonna have like a little icon that you can check to click to complete a task does that sound cool it's pretty fun alright so there is my just give it a little template there and move this gallery over so you can tell this is getting kind of messy but alright so now what fields do I want to show in my gallery I'm gonna say I want the title of the task and the status and I can even add another one let's say who it's assigned to I put that over here this item assigned to dot display name since it's a complex field its assigned to that's why I had to do the dot so this one's assigned to Joelle so I only have it looks like I only have three things in here because I haven't refreshed my data source since last time since I started you know adding things to it so I'll do a refresh and now I can see a bunch more tasks are in here alright now what I want to do is let me move this over a little bit I'm gonna have a button so I'm just showing what the status is here but I'm gonna have a button where you can change the status amanda patching can modify an existing record that's what I'm gonna do in this example so I'm going to put a little button on here so let's say I'm gonna do a I'll just do a check and the check can be like it's completed let me get rid of this little arrow so it's not confusing the check is gonna be its you check the box to complete it and so that'll be our super simple example and we'll make this screen actually we'll make it gray and then we'll make it so that when it's completed it'll be green so let's first of all let's change the color so if status equals completed then green otherwise gray okay so all these are great now I'm gonna go ahead and complete one of these just straight just directly here in share points let me do a quick edit and I'll just type the word completed like that now again this is still a text box so we'll talk about choices maybe if we have time but they're a lot more complicated so I've made one completed and then I'm gonna refresh my data source so just so you can see the color different than we did a whole other Power Hour where we did different you know conditionally formatting things I believe and so there's my no doesn't do anything when I click on it but it does have it is a different color and I can even make it so that like the background color mmm Phil see ya status equals completed then yellow otherwise white so in that cool all right so now that one's completed and so now what we want to do is make this button so that it patches and it actually completes the task when you click the button so I'll click on this button and I'll go to the on select and then what I want to do is patch patch the task list and then which record do I want to patch that's this item so when I'm in a gallery since it's because it's a gallery this item means whichever row that I'm on so that's how it knows that that's that particular item is the one that's going to edit and an update so now what is the update that I want to send now remember my syntax is these little curly brackets so I'm going to put status equals oops not status not status equal status colon completed and then close out my so I finished my little patch syntax is super simple what am i patching which item in my patching and what change are my making when I patch it so this is the existing item syntax so then I'll go ahead and play this now I'm going to say I completed this new Wednesday one look at that you'll get like a golf clap or something else pretty fun um yeah so Larry Larry asked a good point so that's exactly what the next thing that I would do is I don't need it to complete them every time I click the button so I could make it so that if it's already completed it you know it only patches if it's not already completed or I can make the button disabled if it's already completed so well let's go look at the whole disabled thing so that's gonna be my display mode so instead of edit which means I can click on it'll do something I can say if status equals completed then display mode dot say bold otherwise display mode dot edit oops I'm saying make sure I do it right display mode dot pin it and then it's actually probably gonna look different let's see see if it'll look different see it now it's like see now it's grayed out though because whenever you disable the control it's not it's not gonna use that regular color it's gonna use disabled color so now it's not green anymore right so what I could do is I could instead of editing the color here I could just put and put it back to gray so that it so we're kind of exploring like all these different ways you can accomplish just this one little simple thing of having a checkbox for completed items so - now that it the reason it's grey is because we have a different property we have a disabled color so disabled color it can be green so basically if see if it's completed then the button is disabled which means see I can't click on it doesn't do anything see the cursor is not like a little hand means I can't it's just it's a disabled button and if it's disabled it's green but these other ones I can check so I'll check this other box right here and now that one see it says completed and it's screen alright so Ariel says I'm glad you guys like that let's say you're displaying the same task list and a different screen do you have to set a refresh on the connection before seeing the update on a different screen that's a good question we could just test that real quick I don't think you'd have to do a refresh because it automatically refreshed it I can't imagine that this one would have like this updated information and another of the same list wouldn't so let's just do that just as a fun quick little test we'll do a stick a gallery on here and put that task list in the gallery and put the title like the way just puts all these random fields in here status okay so there are my titles and statuses and then we got to have a button to take us from that other screen to the screen so stick a button on here and navigate and then it makes you do a transition okay so now let's try another one so we'll go ahead and this one's called stuff here so I'm mark that is completed and then I'll go to screen two and look it says completed so that looks like that looks like that answers your question all right and then I'll since we have time let's talk about this if it was a choice field and how much drastically much more complicated it would need to be now keep in mind now this is what I've done on a recent project it's so much more complicated to deal with choice fields and lookups in people fields in empower apps those fields from SharePoint I'm not talking about any other kind of data source just SharePoint ones that in this project that I've been doing I took all the choice fields that existed and all the lists that I was working with and just changed them to text and it messed old mess with the lookups we kind of needed those but choice fields are also complicated when it comes to like filtering something in a gallery if I have a gallery and I want to filter it where status equals completed it's if it's a choice field it's gonna give me well like that della della Keable error and it's just gonna be harder to deal with in like just lots of different ways in my app so if you can't if if your users are not going to SharePoint to fill out these forms or to interact with whatever your business solution is and you don't have to worry about what the SharePoint interface looks like then you could do that and change them to text fields and then just do these little manual for stuff that's just you know pretty static lists of things like these statuses like where you'd normally do a choice field just do it like this like a little table yeah get Larry I can I might have time to do that mm-hmm all right so um what I was gonna shadow is I'll go ahead and change this to a choice field and show you how much more complicated it is so let's go ahead and go to this list and new in progress and completed or what I want to have as my statuses and see all right and then that drop-down box whatever I just will not put a default and so now it's a choice now it's uh let's go ahead and open it up in here and you can see that this is a choice drop-down box now I need to go refresh my app here and it's gonna do some weird things when i refresh it and it's a completely different type of field now see now it's broken so because it doesn't like this this can't be the status it's not as simple as that anymore it's got to be this more complicated crazy stuff alright so let me show you you go grab that slide real quick sorry oh there we go okay I'm gonna do this Oh data type thing this so if the choice field it's got to be this weirdo data thing just like the weirdness that you have to do with lookups in people fields so this is what the syntax is if it's a choice all right so that's what I have to do if I want to actually set the value of a choice field so notice that all these like are all grayed out and weird now on in my gallery and it started giving me an error on submit so let's go ahead and say how make this a choice field so I'm gonna put some space in here expand it out so I can do this I'm going to do this on the form and then I'm gonna do it in the gallery since just we have 20 minutes left so I'm just actually going to copy now I'm going to type it so keep that in mind to copying and pasting this stuff like this weird syntax like if from my blog or from anybody's blog refer anything some of the quotes come across differently when you copy and paste stuff into powerup so keep that in mind a lot of times you might want to just type it manually so this one I'm gonna do status oops and then the status has got to be that ugly thing here let's see and I did write a blog post about lookup fields in Sharpe and power apps and this whole syntax that you have to do and that's a whole post that I wrote that describes it dave says can you give an example of why you need to keep your lookups well it's really just in SharePoint if if people need to be able to fill out the form and have like that dynamic list of stuff from another list but you don't really have to have it if people aren't going to be going to SharePoint at all to fill out your to fill out your forms then you really don't need to look up either so okay let me just type this oh my gosh this is fun hopefully they'll make this so it's not so painful in the future I'm not sure I think they're the priority is more that whole attachments thing and then ID doesn't matter and these are case-sensitive by the way okay so then the value that I want for the show for this choice and not I'm not going to type it in here it needs to be this [Music] whatever I pick from that drop-down box drop-down status selected dot choice and then I need to close those curly brackets okay so there's my let's see that makes my patch a lot more complicate so let's try that another patch and I'm going to put this one as new and I'll let the galleries are weird when you do this by the way look look how it just like reset the whole gallery in so let's go look at that one that I just that new when I just submitted that I patched see another patch and see it's it's there now and it worked but it just had to change that whole syntax right fun times okay so now this is all weird - because it's confused so I need status dot value so when you have one of these complex fields anytime you're using it you got to put an extra dot basically and when you're referencing it and like when I was submitting it it was dot selected dot choice and when I was showing it up here it's status dot value so you've always got an extra dot with those lookups and metadata and people fields and choice fields that you have to deal with and then this of course is broken so this status completed instead of doing that I have to do this whole thing I'm just going to copy that and instead of making the status be what's in the textbox I'm going to make it be what um just completed like that and then let's look at this so status is not going to equal completed status is going to see status dot remember the dot dot value is going to equal completed see that still didn't get rid of my exclamation mark because oh you got to put a coal in there no status dot yeah it had a couple have it in a couple of different places I had it in a display mode add in the color so I had to go change it in all those places you just keep clicking on the exclamation mark and it takes you to each error and you go through and fix them all right that is weird the way it's not showing my whole list let me refresh this I've seen it do that before it's not there we go yeah come on all right now I have my whole list and then this is the another patch one that I just created and so now that works because I had to change them all to that new syntax it makes sense all right let me go over and look at you guys's questions and stuff yeah so there's yeah there's stands did you write that I think you did saving to SharePoint managed metadata column using the patch function so he talks about the syntax for that and paul combs e co l ms ee did a video on his youtube channel just recently on doing a form that had some managed metadata in a little fancy way that he built to do that in perhaps alright what else more links from Dan thanks Dan yeah he's yeah he's written a lot of posts and things like that about how to use patch so hopefully for you know we'll get really deep into it in that in our class that we teach because we spend like a couple of hours on this whole like patching and collecting and lookup fields in people fields and all that but right Larry but this was just like really try to break it down pretty simple to explain what it is and how it works and how to just use a very simple example of how to just change one field or how to just patch one simple thing just so you'll understand why another thing that you could do just real quick is the reason you might want a patch would be for some kind of logic so I might want this this status instead of using a workflow that runs and does something after something submitted to SharePoint you could use a patch and use logic in the patch syntax to do something so I'm just gonna just super simple example I'm just gonna say if the task name equals awesome then I want the status to be completed okay just because I don't want to have to go like add more fields and do it on so I'm just gonna say if the task name is awesome then it's going to have a different status when it patches it so we'll do that to show you kind of why you would do this logic in your formal got like 10 minutes left so so status is going to be now I'm just like this is one of those things I'm just kind of making it up as I go so if let me break this down I like to put a lot of spaces in here to break it down yeah and that field is txt task name dot txt equals awesome then I want status to be let's see oh wait status : if then I want it to be otherwise I want it to be this other thing let's see I still have to put it in brackets otherwise I want it to just be what I put in that drop-down box and then close my if statement yeah okay let me make sure so here so I'm making sure that I'm closing my if statement so the status equals if I type awesome it's going to equal completed otherwise it's just going to be whatever I type in that box makes sense so it's a silly example but we'll try it out okay so we'll try it out with just typing awesome and then we'll try without what you know typing something else so task name awesome submit and then when we go to SharePoint yeah see now it says completed automatically so and then this one I'm going to put not awesome because I didn't do contains I just said equals it's not awesome then it should equal new yeah cool all right I'm done so you guys um what do you guys think of that is that explain kind of why and how you use your logic and how you can make a cool little button on a gallery that just quickly changes a single value in a list it's pretty useful it's real it's like fun the logic stuff alright I'm gonna go ahead and wrap it up as far as next week you guys put your ideas in the ideas channel in there and then you can vote on other people's ideas by doing a little like a little reaction in there and like a little thumbs up or something hey let me go ahead and flip back to me alright that was fun okay so yeah put your ideas and ideas Channel thanks everybody for joining us after a couple weeks hiatus and oh by the way so are so now that we have all this power apps content in our training site I dub you mentor we've got a ton more content in there that I went ahead and raised the price of the ultimate package for it's a year subscription a lot of you already have the year subscription but for new people it's $8.99 a year but I for you guys I sent out the newsletter today and I put a discount code in there for the month of March and we're extending or giving you a three hundred three hundred dollars off of that ultimate bundle bundle for one more month you can have it at that discount it's called so it's in the newsletter that I sent today and the code is ultimate March deal so you guys hopefully you are interested in all that powerups content and all just sharepoint power-ups learning and um keep keep in touch and we've got a link in on my blog to just wonder laura calm to stay in touch and to join in get on the newsletter if you're not already on it i will see you all next week thanks for coming
Info
Channel: Laura Rogers
Views: 11,615
Rating: 4.7600002 out of 5
Keywords: SharePoint, PowerApps, Office 365, Forms
Id: k3gT-HxUhL8
Channel Id: undefined
Length: 52min 10sec (3130 seconds)
Published: Wed Feb 28 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.