cancel
Showing results for 
Search instead for 
Did you mean: 

Working with CDS Entity Option Set field

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

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

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!

Meet Our Blog Authors
  • PowerApps Community Mentor 2018, Practicing surgeon and former Professor of Surgery, University of Illinois, Chicago.
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Systems developer
  • My name is Timothy Shaw and I create digital solutions using the Power Platform, Office 365, and Azure SQL and handle the IT for a small company in the energy sector. When not building the future :), I enjoy playing guitar, good (or really bad!) sci-fi, Xbox therapy, and hanging with my wife and son. Twitter: @ShortForTim