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

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
Charles_John
Advocate II
Advocate II

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??

View solution in original post

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

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

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??

Charles_John
Advocate II
Advocate II

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,227)