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

Use Button to submit form and update the value of a lookup/dropdown list in the form

Hello.

 

I've created a form that uses a SharePoint choice column to show the status of an item. In the the auto-generated form, this is represented as a dropdown list that queries the SharePoint choice item for four values. I'd like to be able to use a button on the form to change the value of this dropdown and update the item in the form with the new value. 

powerappticketupdate.png

 

I've succesfully done this with Context variables if the field in SharePoint is a text field (via UpdateContext) but I can't get the same technique to work with the dropdown based on the SP Choice column. When I try, I get an error about trying to set a Record value with a Text context variable. I've searched the forum a good long time and figured I try here before giving up. Anyone have any ideas?

 

6 REPLIES 6
Community Support Team
Community Support Team

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

Hi @RayBoone,

 

I'm not sure that I have fully understood your need. Did you mean that you want not to submit the whole edit form but only change one choice column in the form when a button clicking? May I know the formula that you used to update the text field? 

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RayBoone
Level: Powered On

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

@v-monli-msft I didn't use a formula per se...just set the value of the text field to a context variable. The data card was set to update the value in the SharePoint list. Then I did an UpdateContext/SubmitForm on the field when the button was pressed. 

 

  texttocontext.pngupdatecontextandsubmitform.png

RayBoone
Level: Powered On

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

Any other thoughts?

Highlighted
ShanP
Level: Powered On

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

For dropdowns, you need to add Selected.Value at the end. So for example:

 

DataCardValue5.Selected.Value

 

as opposed to a text field, which is DataCardValue5.Text

RayBoone
Level: Powered On

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

Thank you--haven't had a chance to get back to it yet, but will post back here when I do.

Digital
Level 8

Re: Use Button to submit form and update the value of a lookup/dropdown list in the form

I know this is an ancient thread, but it came up when I searched a similar problem so thought I'd post a response as it may help someone else.

 

You can update the value of a combo box using a button by using a context variable in the DefaultSelectedItems property of the combo box.

 

I think this might solve the problem. When form mode is new the combox box value is set to the contents of varStatus. You can then use a button to update the context variable for the new status. I have tested this and it works fine.

 

If(
Form1.Mode = FormMode.New,
{Value: varStatus},
Parent.Default
)

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,246)