cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SamuelParkes
Frequent Visitor

Send email with information from completed form.

Capture.PNG

Hi, im trying to get the button to submit the data to the source and to send an email notifying the recipient that a new order has been created with the details in the email. 

Any help is greatly appreciated!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Thanks heaps for your reply, this makes sense however i keep getting an error saying invalid name? any reason you can think of for that occuring??

View solution in original post

Anonymous
Not applicable

Please provide specifics around you code. Invalid Name means the app object you referred to does not exists. I used dummy names to refered to all of your TextInputs and DatePickers, be sure they're all replaced with the actual names.

 

View solution in original post

12 REPLIES 12
Anonymous
Not applicable

Hi,

 

Many ways to do it with out hearing more specifics, but here's one:

Assuming this is a new order creating a new record in your source, with your "Submit & Email" button properties

 

set On Select:

 

 

Patch(
SourceTable,
Defaults(SourceTable),
{OrderIDField: PumpOrderID.Text, StartDateField: StartDate.Value, EndDateField: EndDate.Value, TotalOrderField: TotalOrder.Text, mLDayField: mLDay.Text, CommentField: Commments.Text}
)

 

 

Something like that to patch the source table, see Patch Function

 

And then to email mail it, set up a Flow and also include it in the On Select Property

 

Capture.PNG

 

 

'PowerApp->Sendanemail'.Run(
    "HardCodedEmail",
     "New Order " & PumpOrderID.Text, 
     "Order Details " & PumpOrderID.Text & 
"Start Date " & StartDateField.Text &
"Comments " & Comments.Text
)

 

And include any fields you want by concatenation. You could do a fancier HTML email. Check out some posts on PowerApps HTML Tables using Concat

 

 

 

Thanks heaps for your reply, this makes sense however i keep getting an error saying invalid name? any reason you can think of for that occuring??

Anonymous
Not applicable

Please provide specifics around you code. Invalid Name means the app object you referred to does not exists. I used dummy names to refered to all of your TextInputs and DatePickers, be sure they're all replaced with the actual names.

 

Hi, so ive currently got the following code"

Patch(
    'Pump Orders', 
    Defaults('Pump Orders'), 
    {OrderIDField: DataCardValue12.Text, StartDateField: DataCardValue17.Value, EndDateField: DataCardValue10.Value, TotalOrderField: DataCardValue18.Text, mLDayField: DataCardValue11.Text, CommentField: DataCardValue9.Text}
)
&&
'PowerApp->Sendanemail'.Run(
    "HardCodedEmail",
     "New Order " & PumpOrderID.Text, 
     "Order Details " & PumpOrderID.Text & 
     "Start Date " & StartDateField.Text &
     "Comments " & Comments.Text
)

Im not overly experienced in this field so your help has been awesome! thanks!!

Im not sure to do with the field parts of the code its stating that they dont exist

Anonymous
Not applicable

Replace all the OrderIDField, StartedDateField, etc. with the actual column names in your 'Pump Orders' table.

 

 

Patch(
    'Pump Orders', 
    Defaults('Pump Orders'), 
    {OrderIDField: DataCardValue12.Text, StartDateField: DataCardValue17.Value, EndDateField: DataCardValue10.Value, TotalOrderField: DataCardValue18.Text, mLDayField: DataCardValue11.Text, CommentField: DataCardValue9.Text}
);
'PowerApp->Sendanemail'.Run(
    "Email@domain.com",
     "New Order " & DataCardValue12.Text, 
     "Order Details " & DataCardValue12.Text & 
     "Start Date " & DataCardValue17.Value &
     "Comments " & DataCardValue9.Text
)

and separate multiple functions with semi-colons. With the email, you can refer to the same DataCardValue fields that populate the table on Patch.

 

Thanks so much that makes sense, however im now getting an error saying the argument does not match the expected type 'number' because im stating .text in the formula. I changed it for .selecteddate and thats working however not sure what to do with the numbers??

Anonymous
Not applicable

Depending on the control, you can use the value function:
Value(InputControl.Text)
or if the control has a value property, something like :
Control.Selected.Value

Hey mate, thanks heaps that all worked and i managed to clear all errors and get the code to work. Problem is im not getting any of the values that get filled out in the email (see image) 

Thanks so much. Capture.JPG

Im a little bit late for the party, but I hope somebody is still able to help me. Powerapps doesn`t let me use the .Value function with a time value. Am I doing something wrong or can I not use the flow method for time values?

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (4,014)