hello folks welcome back in this video i will demo on
how to call a flow from power apps to send email so stay tuned and let's go to
the demo after this short intro let's look at the requirement first so
the idea is that we need to create a new powerapp
application with the form containing customer contact details for example
customer name email address phone number etc and a
button to submit that information once the button is clicked the
information entered by the user on the powerapps form needs to be
emailed to the manager to achieve this i will first create a
blank canvas app in powerapps i will create a form
containing all the fields and a button then i will create an
automated flow in power automate and i will use the powerapps as a
trigger option in the flow i will configure the flow to get
powerapps form data and email to manager finally i will link
the powerapps form to the newly created power automate
flow on button click so let's start the demo
i am on office 365 landing page from the left
menu you can see these ellipses if i click on them you can see all the
application listed here if you don't see the
powerapps application here you can click on all apps and then
if i scroll down you should be able to see the powerapps application here so
it's listed here so if i click on it that will take me
to the powerapps landing page where i can create
the powerapps application so as i said before we're going to create
a canvas app from blank so i will click on
canvas app from blank option and i will give this
app a name i will just call it client contacts and by default i will leave it
as a tablet app click on create button here this will
create a blank canvas app for me where i can drag and
drop the fields and create my first form so
this is an empty area to work with if i go from the
top menu under the insert tab and if i check the
label first and i get my first label so this will be the
name and then i put another label here this may be
email address and let's say i will just create two
label here then i will create a text field from here text input field
so the person can input the name and email of the client
so the first one will be here so i can rename this text input 1 named
txt and then i will create another one text input as well
and this one i will rename it to the email txt
now i need a button so if i click on the button icon here
this will create a button for me i will change the text of the button from this
right hand property menu just call it submit now
the form is pretty much done so we want to capture
the person name and email address now what we actually want
is if someone click this button it should actually
email that information to the manager so we need to create a power automatic flow
which will actually collect this information from power apps and
email to the manager so if i navigate back to office 365 from the left menu
i will select the option of power automate by the way you can come on this
action menu inside the power app and click power power automate and you
can create a flow from here as well but i will show you from the power
automate application icon how you can create
a flow and then later on attach that flow to this app
so you may already have a flow which you want to use in the power automate so you
can do that way if i go back to power automate i will
click on create so i will create an instant cloud flow because this is going
to be a trigger by this power app so i cannot use an automated flow i need
to use an instant cloud flow option so if i
click on that i will give this flow a name
just say send client information and the trigger for this flow is going to be
powerapps use a button or link in powerapps to trigger an action
in this flow so i will select that and i will click on create
now the trigger is created so next step is we need to send an email to the
manager so if i click on next step i'll just say
send an email notification just for this testing i will just put my
name in there so i will select my name and i will say in the title i'll just
say new client and then in the body of the email
i will just put the body ask in powerapps so if i select that
so whatever we send from powerapp is going to be in the body
so if i go back to powerapp we have a name input and email input
so we'll capture this both fields and then
we will send it to the body of this email so if i click on
save so the name of the workflow is send client information so that information
is saved so the power automate is saved we have
created a power admit flow for powerapps so now if i go back to client contacts
now i will select this submit button and i will click on power automate
and i will click on send client information now this is connecting
the power automatic flow with this power app so send
client information dot run so in here inside this dot run method we
need to provide the body what we're going to send so the
body we can make something like we can either put in
a variable or we can just put the the name and the
email value inside the body as it is so let's create a variable so
before this we will just create a set and create a variable
we call it html string and let me just close this one for now
so we have a separate method there so html string and the value we're going
to set to this html string so we need to
set the html string value so we need to get the name
and the email but to do in a better way what we'll do is we'll create the name
and email labels as well and then the values
so to make the label bold i will just use
b and then i will say name colon space
and then i will use and and the value of that column which is from
name text dot text so we'll say name text
dot text yeah and then i will do and then again i will do
break line so break row br in html and then also do bold again
and this time inside that board it's probably
the email put email call in space and then at the end i will do and again
now the value from this email text column so email txt
dot text so now we have that html string variable
which contains the name label in bold and the value
and the email inboard after break row and the value in the email
column now we can pass this html string
variable to this method which is running the flow
so it can have that variable in the body so we are passing that variable here
to the power automate flow method so now when we run this application
when we fill the information submit this label will collect the information and
pass it on to the flow and then flow is already putting the information in the
body of the email so i will click on
file and click on save and the name is client contact which is fine saving in
the cloud now the power app is saved if i click on
share i can share with other people or i can
just click on the web link to access the app
the workflow we have already saved it and it's ready to use
so if i go one step back i will see the run history of the workflow when it has
run successfully okay now if i navigate to the app
and i will put the name here name as neil gibson
i'll just put email address as nail at outlook.com and i will click on submit
you can make this form fancy you can add more fields you can
make it navigate to a submit or success screen
so now if i go to manage my flow and if i refresh this page this flow
should have already ran so now you can see the flow
already ran successfully and it has managed to send an email and now you
can see the body of the email is something like this now if i navigate
back to my outlook there is the email received and you can
see the name and email are in bold as we said in the html code
and this information is coming from the
powerapps application using powerautomate into your email
inbox just to wrap up today's video today we have learned how to call a
microsoft power automate flow from powerapps application on a click of
a button thank you for watching this video
consider subscribing if you're new to the channel by pressing the red
subscribe button below this video and click the notification bell icon so
you don't miss any of my future videos as i upload new videos every week give
this video a thumbs up if you found it useful
if you have any question regarding this topic or any other query related to
office 365 please put in the comment section below
i do review my comments on the daily basis
so i will be happy to answer your questions thank you