{"id":4416,"date":"2022-12-30T14:51:58","date_gmt":"2022-12-30T14:51:58","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4416"},"modified":"2022-12-30T14:51:58","modified_gmt":"2022-12-30T14:51:58","slug":"show-create-document-on-active-quotes-only-using-power-fx","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4416","title":{"rendered":"Show &#8216;Create Document&#8217; on Active Quotes only using Power Fx"},"content":{"rendered":"<p><strong>Requirement<\/strong><br \/>\nOnly show &#8216;Create Document&#8217; button for Active Quotes.<\/p>\n<p><strong>Details<\/strong><br \/>\nWhile working on the Dynamics 365 Sales implementation we mostly get these type of requirement where we want to show\/hide button based on the entity status. We can use Ribbon Workbench and apply value rule to our button to hide and show it but here case is different as this is a button introduced by DocumentCorePack. When I checked ribbon definition of quote I did not find this button there and I can&#8217;t apply custom rules without modifying existing commands.<\/p>\n<p>In my second try I thought of generating ribbon definition for the Quote button but that was also not helpful so I finally I thought of checking with DocumentCodePack support, they are really good in answering email and they confirmed they don&#8217;t have any option in the default setting and suggested to create button manually.<\/p>\n<p>And if I can create button, then I can apply my custom rule :), so I used Power Fx to create button and apply check to show only button when quote is activated. Let&#8217;s see I did it:<\/p>\n<p>&gt; To edit command bar for our entity, we need to navigate to our environment and need to edit app<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4418 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc1-300x194.png\" alt=\"createdoc1\" width=\"300\" height=\"194\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc1-300x194.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc1-624x403.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc1.png 758w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n&gt; It open app studio where we can see all the list of the entity, we can select entity and click on Edit, in our case we want to edit Quote<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4419 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc2-231x300.png\" alt=\"createdoc2\" width=\"231\" height=\"300\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc2-231x300.png 231w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc2.png 360w\" sizes=\"(max-width: 231px) 100vw, 231px\" \/><\/a><\/p>\n<p>&gt; We want to add new button so we can select New Command option like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4420 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc3-283x300.png\" alt=\"createdoc3\" width=\"283\" height=\"300\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc3-283x300.png 283w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc3.png 440w\" sizes=\"(max-width: 283px) 100vw, 283px\" \/><\/a><\/p>\n<p>&gt; Once button is added you can simply drag it to required position easily<br \/>\n&gt; As we want to add a Create Document button so we can follow below link to refer properties<br \/>\nhttps:\/\/support.mscrm-addons.com\/knowledgebase\/how-to-add-the-create-document-button-manually\/<\/p>\n<p>&gt; Once we have button in place, we need to select <strong>Visibility<\/strong> property and set formula option<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4421 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4-300x298.png\" alt=\"createdoc4\" width=\"300\" height=\"298\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4-300x298.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4-150x150.png 150w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4-176x176.png 176w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc4.png 359w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n&gt; We want to show only this button when quote is active so can apply below formula<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc5.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-4422 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc5-300x53.png\" alt=\"createdoc5\" width=\"300\" height=\"53\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc5-300x53.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2022\/12\/createdoc5.png 589w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In the above formula we use Self to select current entity and Item represent collection where we selected our field which we want to validate and finally our condition as we want to show it only in case of Active Quote.<\/p>\n<p>Finally Save and Publish your changes!<\/p>\n<p><strong>Summary<\/strong><br \/>\nThis is how we can add a custom button using Power Fx and apply visibility rule to button.<\/p>\n<p>Hope it will help someone !!<br \/>\n<strong>Keep learning and Keep Sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirement Only show &#8216;Create Document&#8217; button for Active Quotes. Details While working on the Dynamics 365 Sales implementation we mostly get these type of requirement where we want to show\/hide button based on the entity status. We can use Ribbon Workbench and apply value rule to our button to hide and show it but here case is different as this&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=4416\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":4422,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,402],"tags":[1009,1008,1012,824,1011,1010,1013],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4416"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4416"}],"version-history":[{"count":4,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4416\/revisions"}],"predecessor-version":[{"id":4425,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4416\/revisions\/4425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/4422"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}