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

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,988)