cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Medoomi
Resolver I
Resolver I

Retrieve form combobox value *before* submitting form

I have a form, in which one of the cards has a combobox. I need to use its related email record eg.

 

 

combobox1.Selected.email

 

 

to send an email *before* the form is submitted. But... so long as the combobox has been changed, it seems to register as blank before form submission. Is there different code I can use to retrieve it?

The reason I am Emailing prior to the form submission is because after submission, on Form OnSuccess, the related CDS table is refreshed & new form records are no longer selected. Usually the first item in the table/gallery is selected.

1 ACCEPTED SOLUTION

Accepted Solutions

@Medoomi ,

Now the problem is that a Choices() syntax only brings back the Value and Id of the item in the other list, not any other fields you may have included in the lookup. The actual value will be

LookUp(
    YourOtherList,
    Salesperson=YourComboBox.Selected.Value
).email

I am assuming here that SalesPerson is the name of the field in the other list as well - change if required.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

7 REPLIES 7
WarrenBelz
Super User III
Super User III

Hi @Medoomi ,

If you refer to that before form submission, it should work - put that on a label on the screen and see if you get the value you expect.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

zmorek
Power Participant
Power Participant

You could try adding an OnChange property to the combo box, where OnChange it sets the value of a variable = ComboBox1.Selected.Email, then use the variable to send the email (assuming they're only selecting one value for the combo box). If they're selecting multiple values you might need to concat with a delimiter so the email client can use it correctly.

thx @WarrenBelz 

Before form submission on a new form, when an item is selected in that box, using combobox1.Selected.email as a label shows up as blank.

After form submission on a form with mode edit, using combobox1.Selected.email as a label shows the correct value, unless I change the combobox... in which case it then also reverts to empty.

Is there any alternate code to call this value from an unsubmitted form?

@zmorek  Thx so much. Yes, I wondered about that, except that combobox1.Selected.email is a blank value on a new form, or when the combobox selection has been changed...

@Medoomi ,

That was the answer I was unfortunately expecting (given your result). What are the Items of the Combo Box?

Items at the moment are drawn from a lookup field:

SortByColumns(Choices([@Projects].Salesperson'),"cra6a_salesperson")

Am I simply unable to catch a change in the field selection before I submit the form?

@Medoomi ,

Now the problem is that a Choices() syntax only brings back the Value and Id of the item in the other list, not any other fields you may have included in the lookup. The actual value will be

LookUp(
    YourOtherList,
    Salesperson=YourComboBox.Selected.Value
).email

I am assuming here that SalesPerson is the name of the field in the other list as well - change if required.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

@WarrenBelz 

Brilliant! Thank you so very much! Yes, that returns an email value on the form before saving 🙂

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,382)