cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Patch Column Option Set Type Error

Hi,

 

I am trying to patch a data in CDS, 

 

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:"Available"} );Refresh(Inventories)

However, getting the error "The type of this argument InventoryStatus does not match the expected type 'OptionSetValue'. Found type 'Text' "

 

How do i patch the option set type? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Member

Re: Patch Column Option Set Type Error

Hi,

 

I have resolved the issue. It seems most of the reference and documentation does not updated. I have resolved it by putting the code like

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:InventoryStatus.Sold} );Refresh(Inventories)

View solution in original post

12 REPLIES 12
Highlighted
Community Support
Community Support

Re: Patch Column Option Set Type Error

Hi @MudzaffarMansor,

Do you want to update the InventoryStatus column value (Option Set Value) of a record in your CDS entity using Patch function?

Is the InventoryStatus column a Option Set type column or Multiple Option Set type column in CDS Entity?

I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

Set the OnSelect property of the "Patch" button to following:

Patch(
TaskLists,
LookUp(TaskLists, 'Primary Name'="1002"),
{
Approve_Status: "Rejected" /* <-- Approve_Status is a Option Set type column in my Entity*/
}
)

Please check if you have provided a proper value for the InventoryStatus column in your Patch formulaIn other words, the value you provided must has been existed within the available values list of your InventoryStatus column.

Please also take a try to enable the "Use the Common Data Service experimental connector" option within Advanced settings of App settings of your app, then re-load your app, check if the issue is solved.

In addition, please take a try to re-create a new app on your side, then try above formula again, check if the issue still exists.

If the issue still exists, please consider submit an assisted support ticket through the following link:

https://powerapps.microsoft.com/en-us/support/pro/

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
New Member

Re: Patch Column Option Set Type Error

Thanks for the reply. I did tried on blank canvas and seem having same issue.

Screenshot 2019-01-01 at 10.56.45 AM.png

Screenshot 2018-12-31 at 4.50.42 PM.png

 

I also include video showing how i did the canvas app from scratch.

https://1drv.ms/f/s!Ag7iOfP4OCz_uS9M1jFIDfR0CNo1

Highlighted
Anonymous
Not applicable

Re: Patch Column Option Set Type Error

adding in @CarlosFigueira to review and assist. 

 

@Anonymous

Highlighted
New Member

Re: Patch Column Option Set Type Error

Hi,

 

I have resolved the issue. It seems most of the reference and documentation does not updated. I have resolved it by putting the code like

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:InventoryStatus.Sold} );Refresh(Inventories)

View solution in original post

Highlighted
Frequent Visitor

Re: Patch Column Option Set Type Error

Am developing canvas app with gallery , where on click of a button i want to update the optionset value of the selected record. For that am using the "onselect" of the button as below. How you people are taking Inventorystatus in your sample. Note:"new_status" is my optionset field.

 

Patch(entityA, ThisItem,{ new_status:"XXXX" });ModelDrivenFormIntegration.SaveForm();


 

Highlighted
Frequent Visitor

Re: Patch Column Option Set Type Error

How you are loading inventorystatus values here 

Highlighted
Frequent Visitor

Re: Patch Column Option Set Type Error

I am currently experiencing the same issue !! I incur the type error whether I grab from a collection or hard code the option ?? 

 

Highlighted
Advocate II
Advocate II

Re: Patch Column Option Set Type Error

Up !

 

Any solution to do that ?

 

Thanks 

Highlighted
Frequent Visitor

Re: Patch Column Option Set Type Error

This took some working out........ Define a link in the patch to the Option List Column. e.g.

patch(TableName,Lookup(Record1),{OptionList:[@OptionList]."Option1"});

This will add "Option1" to the Column "OptionList" for Record1. The key is the [@OptionList] syntax.

Helpful resources

Announcements
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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