{"id":4776,"date":"2024-07-26T07:28:29","date_gmt":"2024-07-26T07:28:29","guid":{"rendered":"https:\/\/www.aegissofttech.com\/insights\/?p=4776"},"modified":"2025-09-24T11:23:13","modified_gmt":"2025-09-24T11:23:13","slug":"filter-in-dynamiccs-365-ce-canvas-apps","status":"publish","type":"post","link":"https:\/\/www.aegissofttech.com\/insights\/filter-in-dynamiccs-365-ce-canvas-apps\/","title":{"rendered":"Filtering Dynamics 365 CE in Canvas Apps with Option-Sets Tutorial"},"content":{"rendered":"\n<p>Working with Microsoft Dynamics 365 Customer Engagement (CE)\/Dataverse option sets, or choices, in Canvas Apps can be challenging. These choices are crucial for data consistency and user interface efficiency, but often present hurdles in terms of integration and functionality within apps. One major cause behind this is that the options within an option-set are stored as integer values in the database. To address these challenges and optimize your app\u2019s performance, leveraging Microsoft Dynamics CE can be highly beneficial.<\/p>\n\n\n\n<p>This blog delves into the specific challenges faced when handling option sets in Canvas Apps, with a focus on filtering a Contact gallery based on the gender of the contact. We will explore both static and dynamic filtering methods, providing practical solutions to streamline your app development process and enhance user experience.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>STEPS for&nbsp;Filtering Dynamics 365 CE in Canvas Apps with Option-Sets<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>To begin with, we just check the available option in the Gender (Contact table) option-set:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>S.No.<\/strong><\/td><td><strong>Option (Label)<\/strong><\/td><td><strong>Integer Value<\/strong><\/td><\/tr><tr><td>1<\/td><td>Male<\/td><td>1<\/td><\/tr><tr><td>2<\/td><td>Female<\/td><td>2<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"612\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-Apps-with-Option-Sets-1024x612.png\" alt=\"Dynamics 365 CE in Canvas Apps with Option-Sets\" class=\"wp-image-4778\" style=\"width:1022px;height:auto\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-Apps-with-Option-Sets-1024x612.png 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-Apps-with-Option-Sets-300x179.png 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-Apps-with-Option-Sets-768x459.png 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-Apps-with-Option-Sets.png 1210w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>2<\/strong>. We then navigate to our Canvas-App and get an app ready with a screen, a vertical gallery with its data source being set to Dataverse\u2019s Contact table.<\/p>\n\n\n\n<p><strong>3. Static Filtering:<\/strong> In the ITEMS property of the Gallery, we can see that if we begin to write the following formula, it displays the available options in the option-set. In our case, two: Male and Female.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"380\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-1024x380.png\" alt=\"Dynamics 365 CE in Canvas \" class=\"wp-image-4806\" style=\"width:1022px;height:auto\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-1024x380.png 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-300x111.png 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-768x285.png 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas-1536x571.png 1536w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-in-Canvas.png 1715w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Suppose we wish to see only the Female contacts. We add the following PowerFX formula to achieve the same.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>ITEMS<\/strong>&nbsp; =&nbsp; Filter(Contacts, Gender = \u2018Gender (Contacts)\u2019.<strong>Female<\/strong>)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>We can see the Gallery is filtered to show Female contacts. Similarly, we can do it for the Male ones.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1024\" height=\"545\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-Tutorial-1024x545.png\" alt=\"Dynamics 365 CE Tutorial\" class=\"wp-image-4807\" style=\"width:1022px;height:auto\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-Tutorial-1024x545.png 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-Tutorial-300x160.png 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-Tutorial-768x409.png 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Dynamics-365-CE-Tutorial.png 1265w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4. <strong>Dynamic Filtering: <\/strong>We now place a Combo-Box control on our Canvas-App screen and make it display the available Gender options in the drop-down, using the simple Power-FX formula:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>ITEMS = <\/strong>Choices(\u2018Gender (Contacts)\u2019)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"261\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial-1024x261.png\" alt=\"Filtering Dynamics 365 CE Tutorial\" class=\"wp-image-4808\" style=\"width:1022px;height:auto\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial-1024x261.png 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial-300x77.png 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial-768x196.png 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial-1536x392.png 1536w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-Tutorial.png 1843w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>At this point, our desire is to filter the contacts in the gallery based on the item(s) selected in the Combo-Box. Hence, we update the <em>Items <\/em>property of our Contact Gallery as follows.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>ITEMS<\/strong>&nbsp; = Filter(Contacts, Gender <strong>in<\/strong> &lt;combo-box name&gt;.SelectedItems)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Let us test it by selecting MALE option in the combo-box.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"528\" src=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-in-Canvas-Apps-Tutorial-1024x528.png\" alt=\"Filtering Dynamics 365 CE in Canvas Apps Tutorial\" class=\"wp-image-4809\" style=\"width:1022px;height:auto\" title=\"\" srcset=\"https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-in-Canvas-Apps-Tutorial-1024x528.png 1024w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-in-Canvas-Apps-Tutorial-300x155.png 300w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-in-Canvas-Apps-Tutorial-768x396.png 768w, https:\/\/www.aegissofttech.com\/insights\/wp-content\/uploads\/2024\/07\/Filtering-Dynamics-365-CE-in-Canvas-Apps-Tutorial.png 1350w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>And it certainly works for the FEMALE option, and the combination of both options too!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>CONCLUSION<\/strong><\/h2>\n\n\n\n<p>That is how one can develop filtering mechanisms for the choices (option-sets) in the Canvas-Apps. Effectively managing Dynamics 365 CE option sets in Canvas Apps is essential for optimal app performance and user experience. By implementing both static and dynamic filtering methods, one can overcome integration challenges and ensure seamless and efficient functionality across various app scenarios.<\/p>\n\n\n\n<p><strong>Read more:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.aegissofttech.com\/insights\/dynamics-365-ce-data-migration-using-adf\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Migrate Data from Dynamics 365 CE to Azure Using ADF<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.aegissofttech.com\/insights\/filter-sub-grid-rows-in-dynamics-365-ce-crm\/\">How to Filter Sub-Grid Rows in Dynamics 365 CE (CRM) Using Fetch-XML &amp; JavaScript?<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":" ","protected":false},"author":11,"featured_media":4810,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[21,19],"tags":[899],"class_list":["post-4776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-crm","category-dynamics-365","tag-filtering-dynamics-365-ce"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/4776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/comments?post=4776"}],"version-history":[{"count":8,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/4776\/revisions"}],"predecessor-version":[{"id":14323,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/posts\/4776\/revisions\/14323"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media\/4810"}],"wp:attachment":[{"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/media?parent=4776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/categories?post=4776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aegissofttech.com\/insights\/wp-json\/wp\/v2\/tags?post=4776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}