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

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
Community Support Team
Community Support Team

Re: Save dropdown field value to SharePoint list

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

Re: Save dropdown field value to SharePoint list

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!
Snacham
Level: Powered On

Re: Save dropdown field value to SharePoint list

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

Community Support Team
Community Support Team

Re: Save dropdown field value to SharePoint list

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

Snacham
Level: Powered On

Re: Save dropdown field value to SharePoint list

ThankYou!! It worked for me.

Snacham
Level: Powered On

Re: Save dropdown field value to SharePoint list

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?

Vaishnav
Level: Powered On

Re: Save dropdown field value to SharePoint list

@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

ErrorScreen.pngError

SharepointList.PNGSharepointList

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: 407 members 4,845 guests
Please welcome our newest community members: