Showing results for 
Search instead for 
Did you mean: 
New Member

CDS Connector Option Set - Any way to patch with a number?

I have a Canvas App used for offline data capture that has been in use for about a year. It uses the "Dynamics 365" Connector, and I am now looking at migrating it to the new CDS Connector, but it's turning out to be a more complex transition than I had initially hoped. I'm having an issue with the Option Sets.


Option Sets and the Dynamics 365 Connector

The Canvas App has > 100 Combo Box controls for data capture. The items in these controls have Number values behind them which map to option set values in Dynamics/CDS. When capturing data with the Dynamics 365 Connector, i just need to reference the number value and it saves the option set in the record. This is ideal, as for the offline functionality, I don't need to cache 100+ option sets in the device.


    new_myfield: 1
Patch('My Records', MyCollection)



CDS Connector

So with the CDS Connector, it wants me to reference that specific option set, which seems to be a data type of it's own in PowerApps. If I pass in a number, I get an error saying: "The type of this argument 'new_myfield' does not match the expected type 'OptionSetValue'. Found Type 'Number'. " . I can't create an enum or OptionSetValue using the number at runtime. With other Canvas Apps that have fewer Option Sets, I have successfully achieved the offline functionality with CDS connector by saving the Option Sets to the device, and then loading them into the choices into the combo boxes. If possible, I would like to avoid this, due to the high number of option sets.


What I'm looking for is a way to get write an Option Set Value to CDS from a number in PowerApps. There is a helpful solution in this post ( that shows how to reference a CDS option set by its value. This doesn't work for me however, as the value must be wrapped in single quotes, and I need to dynamically reference the value using the selected item of the combo box.

The other two ways I'm approaching this are:

  1. Trying to cast the Number as an OptionSet when I capture the data to a collection. This doesn't seem to be achievable through PowerApps formulas.

  2. Getting the OptionSetValue from the number value when patching to the Data Source (as the device will always have connection, and thus be aware of the option sets when writing records to CDS). I'm trying to achieve this by using a Lookup() on the Option Set choices, but there is no attribute of the choices that I can use in the condition. The 'Value' keyword doesn't match the type of the Number


    new_myfield:LookUp(Choices('My Option Set'), Value = 1)



I hope this makes some sense.


Any ideas on this would be greatly appreciated, though I realise I may have to resort to caching all of the option sets.





Community Support
Community Support



Looking through this, I am not certain on how to make this interaction work in the way you want either. This might be a better question to bring to the Microsoft Support team. I will include a link below; on how to do so. Unless any other communities members have any idea how to do this, feel free to chime in.


If you would like to create a ticket with Microsoft Customer Support here is a link on how to do so:








Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not applicable

Hi @Tadhg- ,

Have you found any solution? I am facing the similar issue. I am using two option set having Yes and No items. Not able to use toggle in collect function for offline mode.

Hi @Anonymous,

The design I went with in the end was to cache the Options of ALL option sets (including each individual OOTB Yes/No). This was not ideal as there was over 100 option sets and they were re-loaded every time the app was started, but it was the best solution I came up with at the time.
In order to use Toggle controls, I used an IF expression when capturing my data. something like:



IF(toggle.value, Lookup(myLocalOptionSet, Text(Value) = "Yes", Value), Lookup(myLocalOptionSet, Text(Value) = "No", Value))



I can't remember the exact syntax.

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,000)