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

Cannot create record

Hi,

 

Yesterday my app was working perfectly, today I'm getting this error 

 

invalid argument type. Expecting a OptionSetValue value, but of a different schema

This is my code

 

 

   UpdateContext(
            {
                CreatedAsset: Patch(
                    Assets,
                    Defaults(Assets),
                    {
                        'Bar-code': grp_CreateNewAsset_dlg_tboxBarcode.Text,
                        'Asset Type': grp_CreateNewAsset_dlg_cbAssetTypes.Selected,
                        Product: grp_CreateNewAsset_dlg_cbProduct.Selected,
                        Warehouse: Resource.Warehouse,
                        Ownership: 'Asset Ownership'.Company,
                        'System Status': 'Asset System Status'.Installed
                    }
                )
            }
        );

the error is being caused by the system status field, I don't know what the value should be other than this option set

 

this is my field


2019-10-05_17-13-52.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

any ideas for this issue, is the CDS 2.0 is ready for production or not yet

3 REPLIES 3
Community Support Team
Community Support Team

Re: Cannot create record

Hi @aboodhamwi ,

Do you mean that you can not update optionset successfully?

I've made a similar test but not met the problem like your description.

Here's my formula:

Patch(teachers,Defaults(teachers),{customstatus:test819.Draft})  //customstatus is the field name, test819 is the option set name

This works good.

Has your problem been solved?

If the problem still exists, please try to recreate the app and try again.

 

 

Best regards,

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

Re: Cannot create record

Hi @v-yutliu-msft,

 

What I'm saying is, there is no reason for this error to be thrown, i don't know why I'm getting it, before it was working, and suddenly it have this error, as your knowledge is the CDS 2.0 is stable or not yet

TimRob
Level: Powered On

Re: Cannot create record

I think you can get the Option Set value patched by using the Value of the option that you're attempting to update.

 

I found this post that said to use the numeric value of the item you're trying to set.

 

I don't know if you are trying to patch a value that you're allowing the user to set, but I found to get the correct item input for that scenario to append "Value" to the function:

 

"XXXX_communicationtype: CommunicationType.Selected.Value"

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.

Users Online
Currently online: 364 members 6,555 guests
Please welcome our newest community members: