How to use Send Email with Options with Multiple Responses in Microsoft Power Automate Cloud Flow?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is created based on the response received by one of the user uh for the video which I uh uploaded a long back uh titled as how to send email with options in power automate now when you send emails with options in power automate you get an uh option to send email to multiple users okay now what happens is uh if the first user responds the entire workflow gets cancelled and you will be only be registering the one response which you receive from the user now the uh the user does not want that thing to happen like say if you send this to say 15 users then you should receive all the 15 responses and register that back into the system so that's exactly what Ma is uh has mentioned in this comment that uh I sent request to 15 of my friends to approve and select an option only one can approve after the others get error that the workflow is completed or closed okay so basically what the user wants is like if that person is sending the request 15 of this team members then all the 15 team members response should be registered okay now the default behavior of send email with option is you know uh when a first response is received the workflow gets completed so the other users may not get a chance to provide a valid response so uh let's uh see the problem statement first um let me share my screen okay now here if you see uh send email with options default Behavior as I mentioned to you it allows an email to be sent with options embedded in email user can respond to options and it get registered back to the source the problem with this approach is even if emails are sent to number of parties only the the option registered first by any user will be considered the workflow gets cancelled and other users cannot register their response back now the problem statement is uh a set of options to be presented to users now when I say users means it is more than one so it can be 15 it can be 20 who can respond back with the responses the response needs to be stored in an Excel document so you colate all the responses put that in an Excel document and that's it you know now all users response must be noted and not just one users response you send email with options so that's what uh we need to work on So based on that request I have uh created a flow you know now in that flow I'm asking a basic simple question you know that simple question is uh favorite food okay and I I'm presenting the user with four options so let's test this and see how it works okay so let me test it manually and for an example I have three users now one is Gish second is Alex and third is Adel okay now I've said run this workflow now I should be receiving an email um based on the questions presented to me so I'll be the first user uh and there are like other users like now if you see here I'm in Alex inbox Alex has received this email Alex is it says select one of the options below to respond okay what is your favorite food so let's say Alex says pasta and Alex's response has been successfully registered let's go to Adel Adel will also receive a response uh receive an email and Adel will say sardu okay so sardu has been registered and I will pick up Sani okay as as a response now all the three users response has been registered now what I've done like once all the users have responded I have sent an email to myself getting all the responses back okay but our goal was to put all this information in one drive Excel okay now if I go to One Drive uh I should technically see uh one file which is getting generated over here it might take a while for the dat to populate so once this is generated I can open this file okay and then this file should have the all the three responses now if you don't see responses you may see in a while as you saw that there was only one record shown but now after a while it show three record because it it takes time to write this file and store it in one drive now that's what our goal was you know and we have achieved that goal so this is what was requested by the user and then this is all the responses from the user has been recorded now how did we achieve that that's a question okay so let's go into the flow first okay so there are multiple options happening over here first thing we need to create a file in one drive okay second you need to Loop through the responses okay now I have taken a manually trigger a flow option okay so let me edit this flow so what happens is like I trigger this flow manually you can make it automated scheduled uh or based on some action okay now this is a simple trigger okay doesn't do anything fancy you just click on a button there is one variable which is email array okay which is of type array and it will take all the email address of the user to which you need to send an email okay now you can pick up any uh number of email address I just picked three okay then this is good then we have a result initially now this is where all the result will stored okay now the what is the result result is email address and the responses okay now there's no initial value that's fine okay let's go and build one drive uh Excel file okay now create Excel file in one drive so you need to make use of get file content okay now remember for this application to work what you need to do is like you need to go into one drive pick up any folder what you want and create one file blank file the BL file will have nothing in it it will just have my and name the file anything like I named it my excel. xlsx so this file is needed okay now why it is needed is just for composing activity okay now here when you say get file content you need to select that file so which I have selected that file from my one drive once you do that you create a file and you pick up any part I picked the root part of my one drive okay and then I the name of the file I have renamed it based on the date time UTC now okay you can pick up any name okay file content is the body of the file content okay so I have selected that now the file has been created now within an Excel file the Excel file which we have created now this is a table you know if you see here this is actually a table okay now the table name is called a survey response okay you can name it anything I just named it server response now within an Excel there is a table we have created now that thing if you see here the table name is server response okay location is one drive for business document library is one drive the file is the ID of create file from where which we have created so that's the IDE of this table range now I just need two columns so the notation is dollar A1 colon dollar B1 so if you see here A1 B1 so that's what it says the limit for that particular table so that we need to default it so if you have five options you can put uh if you have five columns then you can put A1 to A1 yeah okay so that's that's how you represent the table range column names user email response now remember this is important whatever name you pick this will form the result result where result array initialization value okay so user email comma user response okay now because I'm only collecting two values so user email and us a response okay now we have created Excel file in one drive so this is all fine now what we do is like we Loop through the uh email address right Loop through the email address and send out an email now this one send email with options now remember this send email with OP options what happens is like if you select this um question you know subject user options you know whatever things you put over here and loop through that through V email array because you need to send this uh email with option to multiple users then what might happen is like this will run and then it will wait for the first user to respond so for that not to happen what you may need to do is like maybe under this apply to each if I go into the setting I have turned on the concurrency control I made it 20 so I'll assume that I will send this response to less than 20 users but if you want more you can increase it accordingly okay so this is an important step else what might happen is like uh the user email response email will be sent uh one by one okay but we don't want that to happen we want all the responses all the email to be sent to all the users at once okay so that's an important step then what you do is you collect the indiv idual responses now here you're forming that uh array okay now this is an array actually okay now this is just array with one element okay why I say this is an array because this is like the format user email user response now you know from where this is coming user email user response we have created a table and we said that column name is user email comma user response now you need to use that same text okay and user email is current item what you are looping through and user responses like the you get a response basically uh let me show me let me show you this is how it looks so send email with options will give you selected option and user email address okay once that is done you append response to array variable because you need to have a continuous string of array variable now if this is the first response then you need to append it to array variable now how do I do is like I use like a append response to array variable I pick up the variable name and I add that output of the response okay so if you see this output this is individual responses okay now we have collected all this value or we have collected all the responses then what we Loop the result and write in Excel now remember these two step okay this two step is we can't merge it it has to be separate okay now why this has to be separate because we don't know when the user is going to respond back okay so that's why we have created a separate so this is an apply to each Loop it is taking the value from the where result array and it is just adding a row into the table now if you see add a row into the table it is the location is one drive for business document library is one drive file is the ID of the file which you have created using the create file options table is the custom value now this table value is um the one which you mentioned that by while create an Excel file you have said that you are creating a table now you need to pick that value and the row is the current item now the last two options are optional I've just created an HTML table out of that where result array and I'm sending an email to myself with that table okay so that's it folks this is all about collecting a responses multiple responses from multiple users okay uh and uh storing this file in one drive so the resultant one drive file uh which is in Excel uh will look like this okay so that mean these are the email addresses which you have sent and these are the responses you receive now make sure the only catch with this approach is there are two catches one catch is you send out an email to all you know now you this Excel file will not get generated until and unless all the user responds back okay so you will not get that result because it the work work flow will be in a Hanging State and then this file will not get generated that is one second thing is now this is a concurrent approach so uh we need to be very careful that it has to be kind of like a uh proper uh response mechanism being uh set by an end users like say if someone responds in that fraction of second uh alongside multiple users then quite possibly you may lose out some record I haven't tested it but I this is what I uh doubt with this approach okay but uh the things get done you know like this is what you need to get collect the response from the user so you can go ahead and use this now if you want the source code do let me know uh I will share across this uh solution uh in in some repository yeah so that's it folks thanks for watching
Info
Channel: Power Tech Speck
Views: 4,527
Rating: undefined out of 5
Keywords: girish uppal, girish uppal power tech speck, send email with options power automate cloud flow multiple responses parallel execution, Microsoft Power Automate, Microsoft Flow, Microsoft Flow best practice, Power Platform flow automation
Id: npR_Y1JEaC0
Channel Id: undefined
Length: 14min 0sec (840 seconds)
Published: Wed Oct 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.