cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MFern
Level: Powered On

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

10 REPLIES 10
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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
MFern
Level: Powered On

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.

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

MFern
Level: Powered On

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.

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
MFern
Level: Powered On

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!

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
MFern
Level: Powered On

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

MFern
Level: Powered On

Re: Issue with using Combo boxes for emails

Sorry I attached the wrong photo

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: 239 members 5,280 guests
Please welcome our newest community members: