cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vranjan22
Helper III
Helper III

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

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
Skilled Sharer
Skilled Sharer

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.

@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

@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

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

@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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (61,945)