cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vranjan22
Level 8

Form submit to approval to email back to form submitter

Hi,

 

I have created form with approx 140 fields for a new employee to submit his details.

 

Database: SQL Server Enterprise Edition

Connection: On-premise gateway

 

Objective: On successful submission of data to the database, an email with all the details in the form to pre-defined individuals.

 

Any help would be highly appreciated.

 

Thanks,

Vivek

6 REPLIES 6
Anonymous
Not applicable

Re: Form submit to approval to email back to form submitter

Hi,

 

The problem you will get is that the OnSuccess statement of an EditForm will reset every values of your form.

I do send a mail also on one of my apps.

I proceed like that :

- On the OnSelect statement of my button for the SubmitForm, I make a context variable (UpdateContext) taking value of all my actual values of the form before my SubmitForm

- On the OnSuccess  statement of the form, you put "Office365.SendMail(To,Subject,Body(MyContextVariable))"

 

Hope that could help you.

 

Regards, 

 

Louis

mogulman
Level 8

Re: Form submit to approval to email back to form submitter

My view may be a little different.  I have the view to keep the PowerApp as simple as possible.  SQL Server is extremely powerful and flexible.  If I was assigned this I would do it in SQL Server.  I would create an SQL CLR stored procedure to send an HTML formatted email.  It would run every 5 minutes looking for new records, create the email and send it to list.  This way you don't have to kludge a solution in the PowerApp.

vranjan22
Level 8

Re: Form submit to approval to email back to form submitter

@Anonymous 

 

Thank you Louis for your response.

 

Please guide me how did you take all the values of the form using UpdateContext. I have relatively less experience with PowerApps

 

In my case, I would like to take all the 140 fields as mail body.

 

Thanks,

Vivek

vranjan22
Level 8

Re: Form submit to approval to email back to form submitter

@mogulman 

 

Thank you for your response.

 

This is a nice way of doing it and I would prefer to give it a try.

 

Will you be able to guide me any specific articles which can help me with this?

 

Thanks,

Vivek

mogulman
Level 8

Re: Form submit to approval to email back to form submitter

I haven't actually done this.  I'm using Azure SQL DB and it doesn't support SQL CLR.  I'm doing something similar using Azure Function Apps.   Here is an article.

Anonymous
Not applicable

Re: Form submit to approval to email back to form submitter

@vranjan22 

 

Personally, my list doesn't have more than 10 columns so I did it manually...

I don't see any way else to do that Smiley Sad

For UpdateContext, you can do like that : 

UpdateContext( {variable1:TextBox1.Value};

                          {variable2:TextBox2.Value};

                          {variable3:TextBox3.Value};

                          {variable4:TextBox4.Value})

 

Then, use your variables in your mail body

 

Keep me informed of the situation

 

Best regards,

 

Louis

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 427 members 6,030 guests
Please welcome our newest community members: