{"id":26856,"date":"2021-02-19T13:15:37","date_gmt":"2021-02-19T13:15:37","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=26856"},"modified":"2021-02-19T13:15:37","modified_gmt":"2021-02-19T13:15:37","slug":"how-to-show-custom-ribbon-button-while-working-offline-on-mobile-device","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2021\/02\/how-to-show-custom-ribbon-button-while-working-offline-on-mobile-device\/","title":{"rendered":"How to show Custom Ribbon Button while working offline on Mobile Device"},"content":{"rendered":"<p><strong>Introduction:<\/strong><\/p>\n<p style=\"text-align: justify;\">Microsoft has provided the mobile offline feature to work with our data in offline mode even when we don&#8217;t have internet access. Mobile Offline features allows us to work with commands like create, read, update, and delete. Mobile offline features are currently available for iOS and Android devices.<\/p>\n<blockquote><p><em>You can refer the below link to know more about to work in offline mode.<\/em><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/mobile-app\/work-in-offline-mode\">https:\/\/docs.microsoft.com\/en-us\/dynamics365\/mobile-app\/work-in-offline-mode<\/a><\/p><\/blockquote>\n<p style=\"text-align: justify;\">In Dynamics 365 CRM, we can add custom ribbon button on Entity Form, Associated grid and Home grid using the <strong>Ribbon Workbench<\/strong>. But if the user is offline, <strong>custom ribbon button<\/strong> without the enable rule \u2018<strong>Mscrm.IsEntityAvailableForUserInMocaOffline<\/strong>\u2019 won\u2019t be displayed on Mobile Device.<\/p>\n<p style=\"text-align: justify;\">So, let\u2019s see how to add &#8216;<strong>Mscrm.IsEntityAvailableForUserInMocaOffline&#8217;<\/strong>\u00a0enable rule in order to show <strong>custom ribbon button<\/strong> in offline mode as well on the mobile device apps i.e., <strong>Dynamics 365 for Phone <\/strong>and<strong> Field Service (Dynamics 365)<\/strong> apps.<\/p>\n<p style=\"text-align: justify;\">In order to use OOB \u2018<strong>Mscrm.IsEntityAvailableForUserInMocaOffline<\/strong>\u2019 enable rule, we need to add \u2018custom rule\u2019 in the \u2018Enable Rule\u2019 with the <strong>OOB<\/strong> script\u2019s function.<\/p>\n<p style=\"text-align: justify;\">As shown in below screenshot, we have added \u2018Test Button\u2019 on the <strong>Work Order<\/strong> Entity Form. Next, we added the \u2018Enable Rule\u2019 with name \u2018<strong>Mscrm.IsEntityAvailableForUserInMocaOffline\u2019<\/strong> and used \u2018<strong>XrmCore.Rules.Online.IsEntityAvailableForUserInMocaOffline<\/strong>\u2019 function of OOB \u2018<strong>Main_system_library.js<\/strong>\u2019 web resource. And also passed the \u2018SelectedEntityTypeName\u2019 Crm Parameter to the function.<\/p>\n<p>Please refer below screenshot for the same:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-26857\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1.png\" alt=\"\" width=\"1780\" height=\"926\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1.png 1780w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1-300x156.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1-768x400.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1-1024x533.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_1-660x343.png 660w\" sizes=\"(max-width: 1780px) 100vw, 1780px\" \/><\/p>\n<p><strong><em>Note:<\/em><\/strong> <strong><em>This method is not part of Dynamic 365 API document. So, it can be updated by Microsoft without any prior intimation.<\/em><\/strong><\/p>\n<p>After associating this \u2018Enable Rule\u2019 to the \u2018Test Button\u2019, publish the customization in the ribbon workbench using the \u2018Publish\u2019 button.<\/p>\n<p style=\"text-align: justify;\">Once completed with the publishing changes, we can start using the mobile app in offline mode. As shown in below screenshots, we can now see this custom \u2018Test Button\u2019 on <strong>Work Order<\/strong> form in online and offline mode as well.<\/p>\n<p><strong>Online Mode<\/strong>:<\/p>\n<p><img decoding=\"async\" class=\" wp-image-26858 alignleft\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_2.png\" alt=\"\" width=\"303\" height=\"591\" \/> <img decoding=\"async\" class=\"wp-image-26859 aligncenter\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_3.png\" alt=\"\" width=\"332\" height=\"594\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_3.png 414w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_3-168x300.png 168w\" sizes=\"(max-width: 332px) 100vw, 332px\" \/><\/p>\n<p><strong>Offline Mode<\/strong>:<\/p>\n<p><img decoding=\"async\" class=\"wp-image-26860 alignleft\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_4.png\" alt=\"\" width=\"313\" height=\"609\" \/><\/p>\n<p><img decoding=\"async\" class=\"wp-image-26861 alignnone\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/Custom_5.png\" alt=\"\" width=\"318\" height=\"611\" \/><\/p>\n<p><strong><em>Note: When adding this Enable Rule to use custom button in offline mode, make sure that this button uses offline JavaScript for the associated functionality. <\/em><\/strong><\/p>\n<p><strong>Conclusion: <\/strong><\/p>\n<p>As illustrated above, by using \u2018<strong>Mscrm.IsEntityAvailableForUserInMocaOffline<\/strong>\u2019 Enable Rule we can show <strong>custom ribbon button<\/strong> on the <strong>mobile device <\/strong>in offline mode as well.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/attach-2-dynamics-365-crm-upload-multiple-files-sharepoint-cloud-storage\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-26862\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/A2D.jpg\" alt=\"\" width=\"800\" height=\"200\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/A2D.jpg 800w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/A2D-300x75.jpg 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/A2D-768x192.jpg 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2021\/02\/A2D-660x165.jpg 660w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Microsoft has provided the mobile offline feature to work with our data in offline mode even when we don&#8217;t have internet access. Mobile Offline features allows us to work with commands like create, read, update, and delete. Mobile offline features are currently available for iOS and Android devices. You can refer the below link\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2021\/02\/how-to-show-custom-ribbon-button-while-working-offline-on-mobile-device\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,19,27],"tags":[545,592],"class_list":["post-26856","post","type-post","status-publish","format-standard","hentry","category-dynamics-365","category-dynamics-crm","category-field-service-2","tag-dynamics-365-crm","tag-dynamics-crm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/26856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=26856"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/26856\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=26856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=26856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=26856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}