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

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

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

6 REPLIES 6
Community Support Team
Community Support Team

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.
MudzaffarMansor
Level: Powered On

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

TopShelf-MSFT
Level 10

Re: Patch Column Option Set Type Error

adding in @CarlosFigueira to review and assist. 

 

@TopShelf-MSFT

Highlighted
MudzaffarMansor
Level: Powered On

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

rtb360test1
Level: Powered On

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();


 

rtb360test1
Level: Powered On

Re: Patch Column Option Set Type Error

How you are loading inventorystatus values here 

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 (Last 30 Days)
Users online (5,673)