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

Issue with using Combo boxes for emails

I am trying to create a submition form which the user adds their sales person and pm from separate combo boxes. My onsuccess value for the form is to send the email to the selected users once the form is submitted. Below is my formula, please help me find out what is wrong or if there is a better way. I chose not to do one combo box as our employees will most likely forget to choose both sales person and project manager. I also put a label under the combo box to ensure there was an actual email showing. If I hard code the to field, everything works fine. I am unsure what to do.

 

Back();Office365.SendEmail(SalesComboBox.Selected.Email & ";" & PMComboBox.Selected.Email,"New Open Issue: " & "Date:" & DataCardValue10.Text & "; Project Number: " & DataCardValue9.Text,"Project Name: " & DataCardValue11.Text & " Notes: " & NotesText.Text & "Please see the attached pictures for the open issue.",{Attachments: CameraPics,Importance: "High"})

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Issue with using Combo boxes for emails

Ah, ok well that is valuable information - and yes, thinking about it, after you submit a new item, the form is cleared, so those values from the textboxes won't exist!

 

On your OnSucess of the form, have it

Set(LastSubmittedItem, FormName.LastSubmit);

 

Then use Office365.SendEmailV2() but use the column names rather than the textbox names so

Office365.SendEmailV2(LastSubmittedItem.SalesPersonColumnName & " ; " & LastSubmittedItem.PMColumnName  etc. etc. )

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

10 REPLIES 10
Highlighted
Super User
Super User

Re: Issue with using Combo boxes for emails

Hello!

 

So my first thought on this, is - does it fail when you only choose the first item? I tested this using SendEmailV2, with only one address and it was successful. Then I thought, well what it probably won't like is having a semicolon Before the second name as part of the email, like ";" & "whateveremail@yourthinger.com" - however I tested this, and it Also worked 🙂 and I also tested with both the older SendEmail and new SendEmailV2..

 

 

So my conclusion from this is that one of your email addresses being used is incorrect, and it cannot send to it - as stated by the error message regarding a recipient being invalid - so can you check that the email addresses are both valid - maybe one has a space or a spelling error in it? OR maybe one of the .email addresses is just a "-" or some other placeholder character?

 

Please let me know your findings - Happy to take a look further if you've confirmed the above 🙂

 

Kind Regards,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Frequent Visitor

Re: Issue with using Combo boxes for emails

Thanks for the reply! Ok, so I double checked the email address and it is correct. What's weird is when I edit an existing record and click the check icon to submit the form, I receive the emails. If I create a new record and click the check icon, I receive the error. My Edit screen is the same screen if you were to create a new record or edit a record. I'm not understanding what I'm doing wrong or what the difference is.

Highlighted
Super User
Super User

Re: Issue with using Combo boxes for emails

Ah, ok well that is valuable information - and yes, thinking about it, after you submit a new item, the form is cleared, so those values from the textboxes won't exist!

 

On your OnSucess of the form, have it

Set(LastSubmittedItem, FormName.LastSubmit);

 

Then use Office365.SendEmailV2() but use the column names rather than the textbox names so

Office365.SendEmailV2(LastSubmittedItem.SalesPersonColumnName & " ; " & LastSubmittedItem.PMColumnName  etc. etc. )

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted
Frequent Visitor

Re: Issue with using Combo boxes for emails

Ok, thank you. I believe I am almost there but I did have a question about using the columns vs the text. My sales people and pms are pulling from an excel spreadsheet I created that is separate from my main sheet that is being populated by the form. So I created custom cards to include my dropdown information. Does that change what I am doing, if not would the formula be:

 

Office365.SendEmailV2(LastSubmittedItem.Email & " ; " & LastSubmittedItem.Email,... )

 

 Or

 

Office365.SendEmailV2(LastSubmittedItem.Reps & " ; " & LastSubmittedItem.PM,... )

 

I apologize if the answer is obvious, I have only been in powerapps for a year or so.

Highlighted
Super User
Super User

Re: Issue with using Combo boxes for emails

Hello!

 

No question is a bad question, so thanks for asking - what I'd personally do if I wanted to explore how to do the selecting, is to create a label on a separate screen - then after a submit start typing LastSubmittedItem. and let the intellisense help you see what options you ahve, and as its a label the result you've chosen will be displayed instantly,

 

In this case I can see from the screenshots provided that your primary is Reps and secondary is Email so it will likely be this sort of format:

Office365.SendEmailV2(LastSubmittedItem.Reps.Email & " ; " & LastSubmittedItem.PM.Email,... )

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Frequent Visitor

Re: Issue with using Combo boxes for emails

Ok, I have fixed the email so now my formula reads as the following on my edit form:

 

Check Icon- OnSelect: SubmitForm(EditForm1)

 

Form OnSuccess:Set(LastSubmittedItem,EditForm1.LastSubmit);Office365.SendEmailV2(LastSubmittedItem.'Sales Rep Emailed' & ";" & LastSubmittedItem.'Project Manager Emailed',Subject,Body,{attachments};Back()

 

Now the email sends, my data updates, I don't get an error. But now the email is the top most record in my gallery, instead of the last submitted form.

 

Thank you for your help!

Highlighted
Super User
Super User

Re: Issue with using Combo boxes for emails

Heya,

 

So is both the last submitted item and the email showing up in the gallery? and what about in the data source?

 

We could do a more convoluted solution, but I feel like there's something missing as to why it's submitting that email to the gallery - would need to understand more about your submit function and how the list is populated 🙂

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Frequent Visitor

Re: Issue with using Combo boxes for emails

Alright ManCat, it's fixed!! I looked into my gallery and had it display the most recent item on top(its not by date its by last item edited using the now() function in my form. (I removed the change sort icon as well so they couldnt reorganize it). 

 

Thank you so much for your help!! 

Highlighted
Frequent Visitor

Re: Issue with using Combo boxes for emails

Sorry I attached the wrong photo

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,922)