In Microsoft Dynamics 365, we have the ability to add custom buttons in a command bar. Most of the time we also make those buttons available on Dynamics 365 Mobile clients. However, the mobile client has some limitations and not all functionalities are available that are on web client. Therefore, sometimes it is best idea to make the custom button not available on mobile client.
We can accomplish this with the help of Ribbon Workbench. It can be downloaded from www.develop1.net and then added as a solution in Dynamics 365 instance. I added a custom button called “Disqualify” on Contact forms, this button is available on web and mobile clients. In this blog, I will walk through the steps to hide “Disqualify” button on mobile clients.
1. In your solution, add JavaScript code as a web resource. I have added mag_/js/hidebutton.js and following is the code that I used.
2. Open Ribbon Workbench.
3. Select the solution that contains mag_/js/hidebutton.js .
4. Once the Solution has been downloaded, select “Contact” entity in solution elements.
5. Click on icon next to “Enable Rules”, and then click on “Add Step”. Select “Custom Rule”. Set the field values as shown in screenshot below.
6. Be sure to publish once the changes have been made.
7. Let’s see the changes in action. I opened the same contact record on both web and mobile clients. Unlike earlier, this time “Disqualify” button no longer appears on Mobile client, but still does Web client.