Power Apps Send Email With A Button [Power Platform Series - Ep. 7]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello folks my name is matthew peterson a trainer at pragmatic works as you saw in that intro video our company does everything from on-demand learning private trainings hackathons virtual mentoring uh we have this wonderful youtube channel here if this is your first time make sure you subscribe if you want to keep up to date on all cool new learning experiences free for you uh and in this video where you're currently at you're in my power platform series i'm on episode 7. so what i've done in this series so far is i've done quite a bit with powerapps a little bit with power bi and now moving to power automate and i want to show how we can use power automate integrated in with power apps to send out an email notification about some details about a record that has been created there are so many different ways to do power automate i have a lot of videos on tap for the rest of this year but in this one i'm going to show you how to send out an email i'm also going to show you at the end how we can send out an email directly from powerapps and not even use powerautomate so without any further ado let's take a look at what we've got going on here so this is the application that i've built feel free to go back and watch in the series of how we got to this point but here's what we want to do next what i want to do is i want to take one of these records and i would like to send out some details about this record to whether maybe it's to a manager to it's the person who created the record and we're going to see how we can make this dynamic in just a few moments so how do we do this well the beautiful thing is power automate is already integrated into the design studio power apps all i need is a button or an icon for my users to click on to kick off the power automate every power automate needs a trigger and our trigger is going to be manually doing it right here from the application so what i'm going to do here is i'm going to go into my template cell that has my records in it and i'm simply just going to put in a random icon and the reason i'm starting off with the random icon to start here with is to show you a little trick so here's an icon but as you notice when i went to icons there are so many and it can be hard to find the one that you want so what i do is i put the random icon in to start with i'll pop open my properties panel and then over here you can see when i hit the icon drop on down there are so many more to look at in a much easier fashion and i can even search for the icon name so i know mine's called mail so i just click on mail and boom there we go we now have our mail icon in so now the next thing i need to do is i need to set some action up when my users click this what do i want to happen well i want a power automate to get kicked off so how i execute that is i come up to my action ribbon and then i'm going to click on power automate now once i go to power automate any flows i've used in the past i can choose or i come down and hit create new flow so i'm going to create a new flow which takes me into power automate now one of the things to know once you do that make sure you're in the same environment that your application is in as well which mine is now i could do a a one i could start completely from scratch or i can take advantage of some templates here within power automate so i'm just going to use this powerapps button template once i click on it the first thing i'm going to do is give this a new name set a powerapps button i'm going to call it sendpark details email now this is my trigger powerapps is going to be the trigger what do i want to happen after my user clicks the button well i need to get the details about that record i need to get the row so i'm going to hit new step here now when doing new steps within power automate typically what i'll do is if i don't have the the actions memorized i'll start with the data source i'm tapping into so in this case i'm tapping into sql so i'm going to choose sql and then i'm going to choose sql server now i will see all of my actions that are associated with sql server and the one that i want for today is called git row i want to get one row of data so i'm going to click git row and then i'm just going to put in the things that are needed here so what i need here is i need the name of my server which is pragmatic works i need the database name i need the table name which in this case is coming from my inspection table and i need the row id how do i get the row id because there's so many rows within sql right well what we're going to do is we're going to say hey powerapps tell powerautomate the exact row that we are referencing here so i click on row id we're going to choose at this moment in time say hey we're just going to ask in powerapps what the row is that we're trying to reference here so i'm going to choose ask and powerapps now technically that action is done but let me give you some best practices here so one of the things that i'll do is with any action i'll hit the ellipses and i will rename it and when i rename it i keep the original name because i like to use this as a reference if i'm building other flows that are similar to it but what i'll do is i'll put a dash and then i'll put down what am i really doing in this flow so i'm getting park inspection record from app something like that if you want to put even more to it you're definitely able to do that by hitting the ellipses and you can add a note and then here you can add you know whatever you want to here to make it more self-explanatory so i'm just going to put whatever you want so now that i have that executed what do i need to do next well the next thing i need to do is i want to use this information and put it into an email i could do this as a teams notification as well you'll learn once you get into power automate there are so many different things you can do but my idea is to send an email so i'm going to click on a new step and this is going to be send email so i'm going to go send an email and i want to use my office 365 outlook so i'm going to send an email v2 now once here who do i want this to go to well if i click on two i can put my name in or if we have the email addresses located within our within a table we can choose add dynamic content and notice here i'm starting to see the dynamic content these are the values that were returned from our original git row action so my inspector is technically a email address that i am logging in but for today's purposes i'm going to hard code it in here because i'm just going to pick a random record to send this email out to but you can see if you've got the email address in the data you can put it in right here but i'm gonna hard code this to come to me so m peterson at pragmaticworks.com now what do i want the subject to be something like here are here are your park inspection details something like that if i can type today there we go now for the body here's what we can start to do i can put deer and then maybe i want to bring back the inspector so i'm going to send this to the inspector so dear inspector comma take a look at your inspection and i'll go to a new line what do i want to return about the inspection well maybe i want to bring back the comments that was recorded for it so i'm going to hard code in comments colon and then i'm just going to select in my dynamic content from my git row action i want to bring the comments in pretty neat pretty easy what else do i want to bring in for today's uh video maybe i'll bring in uh the date of the record creation so over here sometimes you'll notice when you're in dynamic content it won't show you all of the it won't show you all of your values that you have available so when that's the case you can search for that that column value so i think in ours is called the inspection date and now you're seeing here i'm getting more of those columns that we have in the table so i'm going to bring in the inspection date and then i'll bring in one more thing let me say i'll bring in the rating so i'll bring in the rating as well but as you can see you can bring in whatever you want to here now essentially i've brought everything in that i want here i have the date the comments the rating and once i have that executed i'm simply going to hit save now this is now going to save my power out of me again i would go in and rename this action but to save time in the video we're going to keep it as is how do we get this attached to the application well what i'm now going to do is i'm going to head back over to my power apps so again this is called send park details email so i go back over to power automate there it is send park and i'll come off screen here send park details email so once i select it watch what this does it's now going to add this automate to my button up here at the top and now we can see it says all right you're going to use your send part details email flow and then it says dot run so for the dot run here because in the automate one of our pieces to the action uh for the git row we said hey we're going to ask powerapps for it which means we now have to code this part to get it done so how do we code this in well i need to know the row id column within this data source which in my case is the inspection id how can i get the inspection id in here if you've been with me in the series i think you already know because i'm in a gallery and i have a record selected i'm going to say this item dot so this item dot which means hey for this record what value do you want returned well in our case i need the inspection id that is my row identifier within this data table so i'm going to choose inspection id and then i'm going to close that off and at this point it's done that's all i had to do but let's see if this works so i'm going to hit play here and i'm going to choose this once this is march 27th this is the inspector this is what the rating was i'm going to click the mail icon and then within a few seconds my email is going to light up and we're then going to have that email show all of those values so as we can see in just a second here my email just lit up i'm going to bring it on over and it says moment of truth dear here was the inspector take a look at your inspection comments is edit inspection this is the date this is the rating and it worked to a t it worked picture perfect except you might say matt you know what i don't like the way that your date here is showing can you modify that well you know what let's do it doesn't take too long to do so i'm going to close out of this email i'm going to go back into editing my flow so i'm going to come up here and we already tested it i'm going to come back and we're going to edit this so for the date i'm going to get rid of inspection date and this time i'm going to use an expression to format the date that i want it to be so here's how we're going to get this accomplished i'm going to choose expression and i'm going to use an expression called format date time so format date time and then once i have that i'm going to use an open parenthesis to make it active and this says all right give me the time stamp that i'm going to do this formatting over well my timestamp is that date column so i'm going to return back to dynamic content and i'm going to bring in inspection date and as you can see now we're having a whole bunch of stuff and this is the only thing about power automate that hopefully they'll start to revamp this soon but i'm gonna have to scroll all the way over this is what's returning it's returning from my record from that git row action the inspection date then i'm going to put comma and now i'm going to format it the way that i want so i'm going to use single tick marks and i'm going to do m m d d slash yyyy typically anytime i use expressions because they're really hard to read here i'll copy out the whole expression i'm also going to hit ok to make sure it comes in here you can see that looks a little bit different now that it's an expression it has the fx in front of it but then i'll also add any expressions i have i'll add those into my notes section so i can easily reference this down the road so now i'm going to hit save we're going to give it a second here it has now been saved let's send that email one more time and see what it looks like this time so when i hit send the email button we'll give it a second here it should pop up in my email there it comes and now take a notice my date is now formatted the way that i want it so lots of different ways to format dates and times uh so definitely feel free to take a look at that make it to your liking so technically we're done we did a power automate our first one within the application but what i also said i wanted to do is show you how can you just send an email directly from here without setting up a power automate so the way that this is accomplished is we need a new data source connection within this application so if you remember if you've been watching my videos to set up new data connections or to bring data into your application we're going to head over to our data hub and then once here i'm going to click on add data and what i want to bring in is my office 365 connection so i'm going to bring in office 365 and this one is going to be my office 365 outlook so i'm going to select office 365 outlook choose my connection which is attached to me we'll give this a second it's now in here so watch what i can now do with this so i'm gonna go back to my tree view i'm gonna add in another icon here something that looks just a little bit different than the other one we'll do something like um we'll do a check mark here again it doesn't matter what it is you know what just to show you that you can do a button i'm going to show it on a button here so i'll do insert got to make sure i'm in my template cell before i do this so get my whole template cell i'm going to insert a button come over here i'm just going to simply double click and do a send email and now watch what i can do so on the send email on the on select property i'm going to choose my office 365 outlook connector and what i want to do is for my office 365 outlook i want to do a send email so i'm going to do office 365 send email and that's on my on select property and notice it's now giving me all the parameters who should it go to well again i'm going to hard code this in but i'm going to show you how you can use your content within the gallery but i'm just going to send it to myself for right now so in peterson at pragmaticworks.com i have to put it in double quotes because this is a string value comma what is the subject of this and i'm now going to start to make this i'm going to collapse this out so it's a little bit easier to read so i've got my two i'm now going to do my subject something like here is here are the details here are the details about your inspection all right come on spell now there we go comma now for the body here's where we can start to bring in i could have done this earlier but let me show you how i can bring in stuff from this record so i'm going to say um the park inspection 4. now what do i want to do i want to bring in let's say i want to bring in the park id okay something very simple i'm going to do an ampersand and i'm going to go this item dot park id and so now it's going to say the park inspection 4 then we'll bring in the park id ampersand i'll put has comments of has comments of i'll do a colon a space another close that off i want to bring in the comments now so another ampersand and i'll just do this item dot comments but you can see you can start to code this out and put as much information as you want to and it doesn't have to be only what you see in the gallery as you saw i'm bringing in the park id even though the park id is not displayed here so i'm going to do another parentheses here to close this off and i've got my body i've got that in actually i don't need the double quote at the end so just a simple parentheses so i'm now going to hit play i'm going to hit send email and in a second my box should my inbox should light up here again here we go bring it on over and it says the park inspection for one okay so i probably put a space after that has comments of uh and then it brought in the um exactly what i wanted let me come back here it brought in if i go back to my send email step it brought in my this item dot comments for it and so it said the comments were actually edit comments so pretty neat that's how you can send emails directly from your application with a button without using power automate or you can go over and use power automate i typically go with the power automate idea because we can even do some styling on those emails make it look a little bit cleaner a little bit nicer but hopefully this is something you can start using in your application i have a lot more power automate videos on tap for you uh coming up in this series again if you like this video hit like if you like our channel make sure you hit subscribe and hopefully i will be seeing you in the next one [Music]
Info
Channel: Pragmatic Works
Views: 19,784
Rating: undefined out of 5
Keywords: PowerApps Email, PowerApps, Power Apps, formatdatetime, format dates in power automate, power automate expressions, triggers in power automate, dynamic content in power automate, powerapps office365 function, powerapps office365 outlook, PowerApps add an email button, microsoft powerapps, powerapps send email with a button, powerapps tutorial, Send Email In Power Apps, Send Email Notification with Power Automate, Pragmatic Works, Power Automate Templates, Matt Peterson
Id: 2lPsgSZR2pw
Channel Id: undefined
Length: 18min 36sec (1116 seconds)
Published: Mon Apr 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.