web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Working with CDS Entity Option Set field

darogael Profile Picture darogael 123 Most Valuable Professional
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. ','.
 
Capture1.png
Capture2.png
Here's a screenshot of all the numerical values of the four items
Capture3.png
 
 
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. {}
 
Capture4.png
 
And this is how you add the status value in Flow
 
Capture5.png 

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.
 
 
 

Comments

*This post is locked for comments

  • BClouded Profile Picture BClouded 174
    Posted at
    Working with CDS Entity Option Set field

    Sorry to bump up this old post, but how to do set that template fill property of your gallery?
    I tried with switch and using the numeric value or the label value, but it still errors on
    Expecting an OptionSetValue value... 

    Thanks you!

  • KrishnaV Profile Picture KrishnaV 5,023
    Posted at
    Working with CDS Entity Option Set field

    Hi @darogael Daniel,

     

    thank you for the detailed video, I have followed your video step by step but I see the below error. Could you please help me with this.

     

    OffSetError1.pngOffSetError2.png

    Thank you for your help in advance.

     

    Regards,

    Krishna