Turn emails into data - Flow String functions, Email with options, terminate, and more

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's show we won't tell about Microsoft flow know what we're gonna do is we're gonna dive into one my favorite flows I've ever built and walk you through the entire thing fine I even put this off like a year but what the flow does it takes a contact on our website turns it into an email then the email gets the users approval and then if they user approves it adds them to our mailing list and so doing that we're going to talk about some string options we're gonna talk about email with options we're gonna talk about terminate and just a whole bunch of little things that I've wanted to teach you guys about flow for a really long time because you've been asking and I'm just like this is hard stuff to teach but we're gonna do it today but first here's our intro hi my name is Shane Young with power apps nine-one-one those guys and today we're talking about flow on the show right rhyming something joke hahaha anyway so what we're going to do is we're going to kind of solve two big things I'd want to cover for over a year now one is I'm going to walk you through the automated flow that gets generated when every time someone goes to our website and fills out our contact form right because all it happens with us is they turn into emails and so I want to productively put those emails into the system and so I'm gonna walk you through how that whole process works and show you all the pieces of that but you give me a chance to cover email options terminate and a couple other little things about flow that I want to kind of pass along but the most complicated thing in that flow is the string manipulation and so in there I do some wacky shenanigans with strings and so what we're going to do is after I've laid out the whole flow everybody goes okay I got it then we're going to backtrack and we're going to spend a little bit of time just going through some of the different string manipulation pieces with you guys so you understand what is possible through flow expressions and I promise I will get frustrated and annoyed through that process because let's face it extremely operation is annoying but a very necessary evil often so with all that said let's just switch over to my desktop take a look at what this process looks like and kind of go from there oh yeah and if you're thinking wait I've seen this demo before you haven't right so if some of the conference's in some of my training classes I talked a little bit about this this is the first time I'm gonna go through all the pieces we are going to learn new things about email options and terminate and then all the string stuff so if you're thinking you've seen this before I promise you have it anyway with all that said let's switch over to my desktop okay so we're gonna start here on my desktop we're gonna start from power apps nylon one and the reason for that is because probably 95% the bleeds we get for people who hold this website they go oh this is really cool oh yeah there's that good-looking Shane guy and they say oh yeah I want to contact these people as they come in here and they're like a chewy and so then they're like alright and then my email address is and I'm gonna use my personal address so you guys you know don't email my personal address how rude have you been oh you don't care but so we're gonna do that and so then it's alright subject and so then they just type in you I need to know why you are so lazy please tell me and so then that's you know what chewy is sitting to me which is really ops because chewy is right over there taking a nap right now so I wait then they're gonna press send take this little green message at the back and because of our website provider which is Wix you know we basically just get an email from this it doesn't go into a database it doesn't go into an excel file we can download it literally just sends us an email with what you filled out here which is great for simplicity sake but really annoying when you're trying to run an actual business so what happens is we'll go over here to my email real quick and I'm gonna open up the email that we get so you can see what we see is oh here you can see the email address that we get right so something comes from there's no reply at CRM XCOM because one of our internal email addresses and we just get this body and it's just an HTML formatted body so it's not a really convenient for me to break apart but that's what we get and so when we get that let's go over and see what happens on the flow side so if we go to write flow which is right here as you can see what a new email arrives from that address and that's all I can figure here was just the from because anytime I get an email from them it's one of you guys reaching out to us so there it is from there so that's my trigger info remember your flows and your trigger so then what happens is I have to use all of these steps and this is what we're gonna come back to after we get through the whole flow but I run all of these different steps to take the body of the email because the body comes in with the big block of text and so I got a strip out all the HTML tags all the extra formatting so I really am just trying to get out of there the name of the person the email address of that person that's it all I want to capture out of there because once I strip out the name and the email here then what I'm going to do we're going to ignore all of this for the moment is I send an email back to the user so I send an email with options to the user and so with that what I'm going to do is I'm going to say you know thanks for contacting us blah blah blah blah blah blah blah blah but then at the bottom what it says is hey you can we add you to our mailing list all right I hate when companies just automatically put you in their mailing lists so here you're going to see is you know I asked them and so this is what we call an email with options and if we go and look at my personal email now give me a second I'll show you that so here my personal email you're going to see look you there's the all the blah blah blah and then down here hey Chuy maybe we add you to our mailing list alright we barely send emails once a month or more like once a quarter but whatever but can we put you our mailing list yes or no and if Chuy clicks either one of these buttons boop then the flow takes off and runs from there so all flowy Oh Chi has to do is click on one of these buttons so then let's go back over here so what does that look like so then over here you're going to see we're going to ignore the terminate for a second to is there's a condition and the condition just says hey if you know if the selected option is equal yes if Chuy click the yes button then we are going to add Chuy to our subscribed MailChimp mailing list right just programmatically it just hits the API we're due to do magic and it goes and then because I'm a nerd I get an email that says hey you know Chuy joined the mailing last pretty cool use of floor like a I've been getting the same email for two years now ten times a week it's hilarious to me but whatever it makes me happy so this is the process if they say no then all we do is I see that email says boom which is fine but it's just kind of you know once again I just amusing myself in really is this is remnants of the testing process I just never took out lazy eye chewy ass well so that's the process though now what's really neat here is a couple things and so one is this turn eight and so what really happens with people is either people click this yes button and they usually do it almost right away or they never do anything very rarely to someone click the no button which is fair so one of the things that you need to know about flow if you did not already know is that a flow only can run for thirty days so when they get the email right when the email triggers back out they have 30 days to respond to that flow and so if they don't press yes or no at the end of that flow then the flow explodes like I don't know what to do and it just fails so what was happening was because you know a portion of the people never click anything you know what was happening there was that it was coming through and I was seeing all these failures and so I didn't never know if it was a failure because it timed out or if it was a failure because they actually had failed so what I did was I added this terminate step and I said I hate running this term right step and set the status to cancel now if you've got a keen eye you might notice that there's a little red dotted lines right here so what this is really important to understand this is a great feature that not enough people use is there is a feature here called configure run after and so the configure run after step by default on everything is this if the previous step was successful and do this well here I wanted a different behavior I want this terminate step to run if the flow times out right so if this step right here times out then this runs and it sets it to cancel so then that way I have successful flows I have cancelled flows and then the only ones that are failures or actual flows that break because something was wrong so then it's important to understand though with this cancel step so what I then have to do is I need to go to step after it right because this isn't going every time just if a flow sits there for 30 days so then this condition also has a configure run after and this want only runs if this step was skipped and this step would be skipped if someone responded to send an email and options in less than 30 days that that's that's how this works hits right so this is a great tool if you're getting flows that are timing out like if you guys are doing approval flows or other types of flows where you want to have a way to gracefully you know fall out this is a way to do that using the terminate action the other thing that I have done this for is in some of my customer flows it's a very held together with bubble gum process for better back way putting it right like there's so many different ways that this flow can fail we know what all the ways are we've educated the users not to do the things that will cause it happen users don't always listen so what I've done in their particular cases is like say that I know that you know this step up here this one will fail if the user forgot to reading the file alright so then what I can do here is I'll go in I'm back I add an action and then instead of the terminate and then you know I'm gonna just set this - it doesn't matter failed cancel rather make sense for you but before I run this terminate step I will then also just have an action in here for Outlook and like send an email do-do-do-do-do and so then I will send this to the person that crawls this flow to trigger and the body will basically say hey you forgot to rename the file right so I'm sending them so yes you flow failed you know this is why it failed and then do I need you to rerun it I need what do I need them to do so I've had it a bunch of like documentation in there and so then the idea here was that this one would be like hey configure run after and so I want this one to run if this was failed or if it timed out if it skipped basically if anything other than this step was successful I want this to run I want this one to also run we can either in the flow now that I've sent this email and so then I would set this one right here back to that same type of thing configure run after and I say hey I only want you to run if that previous step was skipped so this is how I'm running two things as I use this for some you know real-time feedback to some of my users and some of those really bizarre flows that I have to write like where the I'm depending on the user to do things correctly before they trigger the flow so maybe not something you'd want to do maybe you would but that is something that I have had to do a few times we're gonna get this all out of here because I do not want to break my flow fix this right this is my production flow I'm showing you guys because why wouldn't I so there we go okay so that's one thing I wanted you guys to take out of this right was this whole idea of terminating the other thing I wanted you to take out of here is this idea of sin and email with options and so the reason that I use this strike shame this is kind of like approvals it is but approvals can only be used with people in your tenant whereas the people feeling out this contact form are not in my tenants so for me I couldn't use approval I tried in the first version of this and it blew up every time I sent it to you know my personal email address so Sydney you know the options gave me very similar behaviors but I can send that off to anyone out there on the internet which is what let me facilitate that and I've used this and some other solutions I built as well where I wanted to like ask customers if they want to do X Y there anything the user options up here so I just you saw yes in an O button right so there's just a yes comma no and that's what made the two buttons and then the key was then down here in the condition it's just a saying hey this selected option which is a dynamic content of send email and options is equal to yes then we go down this path no we get on this path so you can have multiple steps as well you could have branches all this fun things and then add a member to the list this is the MailChimp actions are pretty straightforward the nice thing here as well as I didn't have to understand once I connected it to my MailChimp account I then had the ability to do this without a lot of shenanigans I didn't have to understand what was going on I basically just filled in the blanks and you can see there's some pieces here I wish there was a couple other fields exposed but they're not and I feel like messing with them so I said you know what first name last name email address that's enough for me now one of the ways that I should fix this flow at some point which I have not done by should is the the flow if you add yourself to the mailing address or mailing list twice then it will fail so it turns out that there's enough people out there that have literally clicked that yes button like four or five times they just want our mailing this so much so every time they mail us they say yes and then every time it fails so in reality I should have some type of error checking here to see if they exist yeah maybe for a future video but I have not put that in our production flow I just handled I just deal with the fact that those fail and life goes on okay so this is our flow right that was the overview hopefully you took a little bit out of the the terminate pieces and a little bit out of the send email options and so then now what I want to do let's go super nerd right so we had the easy stuff that was fun now it's time for you guys to be be brave and let's just talk about some nerdy stuff and so the nerdy stuff let's go up here and just start at the top and we're not gonna go through all of these don't feel like I'm gonna do that but I want to expose you to a couple of key concepts here and so the first one is really it's understanding like what comes through okay so if we go back over you let's go back a step so go here and so if we go find our Chewie run history right which was this one over here what an email arrives what I want you to do is I have to go grab the body right because that's what I had to deal with so I went here down here to body I'm like oh my goodness it is truly crazy ational so I'm gonna hold down the shift key and then we hit the end is that just copied that whole chunk of or not highlighted all of it so I hit ctrl C which then copies it and so now what I want you to do is I'm gonna open up notepad and so now with my friend notepad yes I use notepad for way too much but I paste it in the entire body oh my goodness oh my goodness oh my goodness that's a lot of stuff so then we go up here to the top I'm gonna say ctrl find I'm gonna type in name and name colon right and say next is though down here Oh scroll way down here oh it's thundering outside hopefully you don't hear that in the recording um so name : this is where then we should be able to go Scroll scroll Scroll scroll Scroll scroll where is it hope so right here so here you can see that the name of the person came through so that's what I want right I want this person's name and in this case Chuy was lazy I only put in his first name so which causes some other weirdness I will talk about a minute but so well I'm really after here is how do I get this chewy which is going to be a dynamic location every time based on all this other fun stuff oh so exhausting right there's a whole bunch of garbage up here I mean hundreds and our theatres thousands of characters so we're gonna talk about our first what do you call that string manipulation so we've got this my clipboard I'm gonna go over here actually we're gonna create a new flow so I'm gonna create an instant flow trigger create because I'm not worried about building that flow right now I'm really just worried about figuring out how to do that so I can put it in my real flow and so here I'm going to use a composed steps if you don't use compose it's just a great way to do some texty stuff or manipulate or whatever you need to in this case I am just going to paste that whole body in here well there it is so we're gonna go down here I want a new step but so now I can dynamically reference that I can probably rename this right we'll just call this rename HTML body OOP there we go so then now that I've got that I'm gonna add another composed up remember I'm not trying to write the flow here I'm trying to figure out what I need to figure out so I didn't go plug it back into my real flow later and so then now that we've got that so what we're gonna do is we're going to go over here to expressions so click on expression and then want to expand the string functions and you can see that there is a whole bunch of these things can cat substrate replaced lower starts with trim split whoa so many things well what I'm really after is this substrate because what a shop string does is it lets me say hey I want to you know only return part of an actual string so what I'm going to do is I'm gonna go here I'm gonna start to type in substring there it is hit tab open my parentheses and then the flow being the annoying thing that is it is now in the way okay a quick way to get that out and so then now it's like alright what text do you want the substring of and so this is where I could paste in that giant body we just copied Oh No thank you instead of a say just use the dynamic content of the HTML body so a much easier way for me to manipulate that text without having to have it jamming up screen here and so then now is right what um what integer do you want oh man it wants a number of where I want to start I can't just tell it I want to start at name all right all right well then what I'm gonna do is I'm just gonna type in a 1 here for a second say okay so before we can do that what I'm gonna have to do is I got to find the string name or like what character count is right so it's like character 7,000 something so what I'm gonna do is I'm going to add a new action above this come on to another compose oh that's not right that's not right third time's a charm there it is and so for this one we're gonna go to expressions and so instead of substring we don't because we need a number we're gonna have to do some type of find hmm where is ah index out so they don't call it find which is what's very common I think they call it index up and so then what text do you want to find the index up and what do you want to search so let's put that up here so I want the index of mmm outputs and then what do I want oh there's that silly thing in the way again and so then what text so I want I want name : right you got to be careful you can't use name here because there's other things name name but name : is where I want so that looks right oak but there's got to be in single quotes because when you have text inside of there you've got to do single quotes so we'll say okay all right not feeling too bad here so let's try this flow string so we're gonna say save and you're gonna say test and then perform the action and test and run my flow done and so the body is the body we don't care but here I'll do that so name starts at character seven hundred seven thousand Oh seven thousand seven or ninety two and something down here you can see you know we didn't do anything with that we just got the first character trimmed out of there so let's edit this out well let's go down here and now that we have a number let's go back to this one and so instead of one what I'm going to do is we want this compose tube I'm gonna rename that real quick as well so rename this to location of name like that so now we go down here expression and so what do week one will do dynamic content location of name outputs and update and test use a previous run so I don't have to click so much alright so then now that number 77 92 still and so compose here oh well close what happened so we got the location and name and so it went ahead and it stripped out everything for us which is what we wanted been front a name right that's what I'm trying to try strip out all the garbage but what happened here was I actually want chewy right so chewy is still way down here somewhere I don't even know it's in there I thought I would find his name so what I did was I went back over to my notepad I said all right so how many characters I'm gonna copy everything from name to chewy side you to control C and then I did a new okay and so then I pasted this in yeah well turn on word wrap so you don't get off weirdness and so then I highlighted all this they like I well that's a whole bunch of characters but this thing does so you can see that this is line one column 202 so tells me that I want to jump two hundred two spaces so we go right here and then we're back up we got an editor flow so I went back to index off and so instead of just straight up index up I want the index of plus 202 now on power apps what we would have done was really like + - OH - and we what went on that is not how flow expressions work so with flow graph digits going we're going to use the add function and so with the add function then we can say add our the number we got right cuz we were already computing that 7,700 number so we do add then the computation there comma 202 and then we hit update and so then now that should fix that and because this string is built on this one we should just be able to plow right through right there shouldn't be anything else for us to test or not Jimmy anything else for us to fight with so we go around here or compose oh I forgot we lost the first character of chewy because it was actually 201 Oh which is actually the mistake that I made a lot and honestly when I was practicing for this video I made that same exact mistake and I left that in here because I want you guys to kind of see that this was the day that I really wrote this for the first time I just kind of did a bunch of this I'd like try something it close and then just start moving characters guys too lazy to count so do another test save and test and so what we should now see is there it is chewy and so then now we know that that is where his name is and so then what I did was kind of did some more pattern matching when y'all look so it looks like this this is how the name portion ends because what happens is you're going to see different results in my case I might see chewy I might say chewy space young I might see you know Suzie day I became if anything so right and so which would have two spaces now so I get a bunch of different things from people and so what I basically had to do is I let's accept the fact that I never knew how long the name was going to be I didn't know whether or not there would be spaces but what I did know it was that when the name was over it would in a span so we could come back down here and be all right so then this is the string that is name only some more renamed this once I kind of remember and so name or start starts with name yeah I don't really have to spend so much time doing this but but it makes it easier I think so it starts with name and so then now I'd go down here and with own another composed step data operations and so then here what I want is I'm going to find oh we don't have fine remember I keep wanting it to be fine but it's called index off and so we're gonna say index of and so then now what I'm going to do is I'm going to use the dynamic content from starts with name and then what I want is I want the index of the close span tag like that and so then that's going to tell me how many characters into that one is the close span and so that was me a small number in this case you know five and so then now we would go down here and we'll stick with our renaming thing so fine end of name alright and so then now we go down here and then work alright last but not least compose and so then here we can say alright for this one I want the I want to do substring we're going to start at the beginning this time so substring and what are we going to do so what text we want the substring of we want the text of the starts with name so we'll grab that so starts with name output and then if we go up here what character do I want to start with I want to start at character zero all right I want to start at the beginning of it and then how many characters who I want to go I want to go the index of that span which was fine in names so then we'll do our dynamic content of fine and name output say okay and so then now let's see your save let's do a test I'll be honest I don't remember if I supposed to start with 0 or 1 so we're gonna find out together in just a moment it was 0 eyes right yeah and so with that so we took this hot pile of garbage remember it was a hundred thousand characters of garbage and we were able to get down to Chewie and folks that's where I want you guys to take away from this around string string expressions right does the whole idea that you should be able to go in and manipulate your way because if you look at this flow so if we go back over here and do it edit you're gonna see that in reality that's all I'm working my way through and so here what I did though is I was putting him in variables so I had not learned to use compose at that point convert compose variables honestly in this case we'll do exactly the same thing but I was just saving on that data those same formulas in two variables and so you know eyes also I wouldn't got the email address there's where I get the first name and then the other thing here that we will not explore now because this video is already too long but one of the other things that I had to deal with was the way that the stream manipulation for me works you know because breaking off spaces was it if you only put one name in there so if you just put chewie then it would get recorded as a last name and the first thing would be blank but I know if you only put her name in there that in reality it should be your first name so I wrote this condition that says you know hey if first name is blank then set last name to first name and set last name to blank so that was the only other little piece of this that I had to do the other thing I don't remind you guys as you start to embrace upon you know writing a flow like this you know this flow probably I probably have eight hours in it easily right but I didn't sit down and write spend eight hours one day I wrote a really simple version write could I take a email it was perfectly the way I want it chewy space young could I get that email in the mail champion okay and so that was enough I went live at that point I started eating all those failures I'm like oh man why don't you in theaters for and so then that's when I found out about the whole people only put in and chewy so that I came in here and edited the flow to add the piece around you know last names and first names getting mismatched then you know I was a great that's a lot less errors now I'm getting more errors oh those are the time adults so then I added the terminate step right and then now I'm getting the errors around people trying to add them sells multiple time thank you for that but I am now um you know working my way through that and so that is you know what's kind of happening so and I need to fix that one but what do you do anyway so just remember don't feel like you have to boil the ocean don't ever feel like especially with flow you can never get it all in the first try so write your first flow get it working and then react you know it's a very iterative process but no big deal because the nice thing here as well is the ones that was failing for it wasn't failing in a way my users were seeing it I was just seeing the failure so I wasn't too concerned with you know I wasn't breaking anything I just wasn't getting the data I wanted okay I don't know that's that's a lot let me know what you guys think of this right is this was this too broad too nerdy you know I struggle with the flows right I'm super comfortable making the power ops video some of these flow ones though I'm like I feel like this is so much but maybe you guys consume this as fast as you consume power apps and I'm just overthinking it because I'm a little slow when it comes to flow I don't know all right um just reminder if your subscriber you can download this flow with all of its craziness so that you can take a look at it and you can play with it so I will make this available as part of downloads if you're not a subscriber yet to our training site go to training dot power-ups 9-1-1 com there's a curated library option and everyone who signs up there right they get the videos first they can download the videos I can download the components that come out of the video so like this flow and all the apps I've built they also have access to sign up for office hours and so once a month being on a meeting with me to ask me questions that's what asked me questions okay with all that I also will say thankfully the power didn't go is under storm rolled through while we were recording this so who and with all that I'm gonna say thanks and have a great day before you go be sure to click on the subscribe button over here that way be notified when new videos come out if you need any help or you want to work together whether your problem is big or small check us out at power apps 9-1-1 we do it all around or if you're looking for more formal training offerings we have those that lean to appear somewhere so check them out thanks and have a great day
Info
Channel: Shane Young
Views: 15,180
Rating: 4.9550562 out of 5
Keywords: Shane Young, powerapps911, power automate, Microsoft Flow, Flow String Manipulation, Email with options, terminate, flow expressions, flow mailchimp, indexof, replace, substring, cancelled, power automate tutorial, power automate string functions, power automate string manipulation, power automate string, microsoft flow string functions, microsoft flow terminate action, microsoft flow terminate, microsoft flow email with options, power automate terminate, microsoft flow mailchimp
Id: TXYmk4d7wi8
Channel Id: undefined
Length: 30min 59sec (1859 seconds)
Published: Sun May 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.