Requirement
Only show ‘Create Document’ button for Active Quotes.
Details
While working on the Dynamics 365 Sales implementation we mostly get these types 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’t apply custom rules without modifying existing commands.
On my second try, I thought of generating ribbon definition for the Quote button but that was also not helpful so I finally thought of checking with DocumentCodePack support. They are really good at answering email and they confirmed they don’t have any option in the default setting and suggested to create button manually.
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’s see I did it:
To edit command bar for our entity, we need to navigate to our environment and need to edit app
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
We want to add new button so we can select New Command option like below,
Once button is added you can simply drag it to required position easily.
As we want to add a Create Document button so we can follow this link to refer properties.
Once we have button in place, we need to select Visibility property and set formula option,
We want to show only this button when quote is active so can apply below formula,
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.
Finally, Save and Publish your changes!
Summary
This is how we can add a custom button using Power Fx and apply visibility rule to button.
Hope it will help someone !!
Keep learning and Keep Sharing !!