cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Snacham
Helper I
Helper I

Save dropdown field value to SharePoint list

Hi,

 

I created dropdown filed on Powerapps form and i wanted to save the dropdown value to SharePoint List when a user submits the form.

 

After doing some research I found that I need to use Patch function, but someone please let me know the formula?

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuxima-msft
Community Support
Community Support

Hi @Snacham 

 

Do you want to save Drop down selected value to SP list?

What is the column type in your SP list? Choice type or others?

I test with one choice type as next:

Data Source:

SaveDropDown.PNG

App test:

Patch method:

Button2.OnSelect=Patch('2019test',Defaults('2019test'), {
Title:DataCardValue5.Text,
ChoiceType:({'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:DataCardValue8.Selected.Value})
}
)

 

SubmitForm Method:

icon3.OnSelect=SubmitForm(Form2)

SaveChoiceTypePatch.PNG

 

savedropdownvalue.gif

 

Then Check:

Check.PNG

 

If the coulmn type is one lookup column type,could you please reference this:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-patch-a-SharePoint-Lookup-Column/td-p/...

 

If you want to Patch one ComboBox value, could you please reference  this:

https://powerusers.microsoft.com/t5/General-Discussion/Patch-Combobox-to-SharePoint-Choice-Coloum/m-...

 

Hope this could be helpful.

 

Best Regards.

Yumia

View solution in original post

6 REPLIES 6
yashag2255
Dual Super User II
Dual Super User II

Hi @Snacham 

 

If you are using an edit form, you can directly add a Data Card for the specific attribute and refer to the same control in the "Update" attribute of your data card. This will automatically save the value when the form is submitted.
If you have individual controls, then using a Patch function would be a better choice.
To create a New Record: 
Patch(SPListName,Defaults(SPListName),{Field1:"Value1",Field2:"Value2"})
-- Defaults is used to create a New record in the SP list.
To update an existing record: 
Patch(SPListName,Lookup(SPListName, Title = TextInput1.Text),{Field1:"Value1",Field2:"Value2"})
-- If you want to modify existing record, we need to use lookup/filter to get the specific record based on some condition that will be updated.
Here, SPListName is the name of my SharePoint list, please modify the formula according to your Data SOurce and its attributes.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi,

 

I need to submit the Powerapps form and save the dropdown data to the SP list. 

 

In short I want to do both Submit and Patch on one button.

 

Please let me know if you have questions.

Thanks

v-yuxima-msft
Community Support
Community Support

Hi @Snacham 

 

Do you want to save Drop down selected value to SP list?

What is the column type in your SP list? Choice type or others?

I test with one choice type as next:

Data Source:

SaveDropDown.PNG

App test:

Patch method:

Button2.OnSelect=Patch('2019test',Defaults('2019test'), {
Title:DataCardValue5.Text,
ChoiceType:({'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:DataCardValue8.Selected.Value})
}
)

 

SubmitForm Method:

icon3.OnSelect=SubmitForm(Form2)

SaveChoiceTypePatch.PNG

 

savedropdownvalue.gif

 

Then Check:

Check.PNG

 

If the coulmn type is one lookup column type,could you please reference this:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-patch-a-SharePoint-Lookup-Column/td-p/...

 

If you want to Patch one ComboBox value, could you please reference  this:

https://powerusers.microsoft.com/t5/General-Discussion/Patch-Combobox-to-SharePoint-Choice-Coloum/m-...

 

Hope this could be helpful.

 

Best Regards.

Yumia

View solution in original post

ThankYou!! It worked for me.

Hi, 

Sorry for bothering you, but the solution you provided will that work for drop-down Column which has connected to datasource?

 

Or do I need to change anything in the formula?

@v-yuxima-msft @Snacham @yashag2255 .... so glad to have you guys to seek help.

 

I tried using the same approach but it is not working for me though. 

 

Situation Background: I have created a form with multiple textboxes and willing to save the data entered into a SharepointList. However, I am unable to get the below things worked out:

1. Getting data from selected item in Dropdown and Patching that to SharePointList
- Error: Does not match the expected type 'Record' found type 'Text'2. Using {ZipCode: ZipCode_tbx.Text} code to patch the zipcode into SPList 

- Error "ZipCode does not match the expected  'Number' type found type 'Text'. "

Patch(House_OrderDetails,Defaults(House_OrderDetails),
{Title: OrderNo_lbl.Text,Builder: Builder_tbx.Text, Lot_Number: LotNumber_tbx.Text,Subdivision: Subdivision_tbx.Text,
 Address: Address_tbx.Text, City:City_tbx.Text, 
State: State_drop.Selected.Value, County: County_tbx.Text,
Date: Date_tbx,ZipCode:Zip_tbx.Text,
House_Type:HouseType_drop.Selected.Value, Equipment_Manufacturer:EquipM_drop.Selected.Value})

I have attached the Snapshots and the code below, kindly help me with this.
Thank you.

 

Vaishnav

ErrorError

SharepointListSharepointList

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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