Description
This blog shows you how you to work with the CDS Entity Option Set fields for the PowerApps Patch and the Flow Condition to work successfully.
Scenario
Consider a ticketing PowerApp which is using a CDS entity. The status of the ticket is saved in an Option Set field in the entity. When the ticket is created the status is changed to In-Progress using the patch function and when the ticket is completed an email notification is sent using Flow.
Instructions
When it comes to working with CDS entity Option Set fields PowerApps and Flow cannot simply use the name of the items in the option set but instead use the value of the item.
As you see below, we have the Status field which is type Option Set. When you click on Edit Option set you will see the four items i.e. New, In-Progress, Pending and Completed. Using these text values in the Flow condition or the PowerApps Patch function will not work. Instead you need to use the value of each option. The value of the New item is 572,090,0000. It is important to know that you need will have to use the numerical values only and remove the commas i.e. ','.
Here's a screenshot of all the numerical values of the four items
Hence in your PowerApps patch function to save the In-Progress item in the Status field will be something like this. When patching the Option Set field give it it's own brackets i.e. {}
And this is how you add the status value in Flow
Video
This video walks you through how the values are used in the Patch function and the Flow condition used in the demo app. In also shows how another way to get the numerical value from Dynamics 365 settings.