{"id":4530,"date":"2017-02-20T18:07:32","date_gmt":"2017-02-20T12:37:32","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=4530"},"modified":"2021-07-21T10:36:24","modified_gmt":"2021-07-21T10:36:24","slug":"modify-oob-ribbon-button-for-specific-activity-type-entity","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2017\/02\/modify-oob-ribbon-button-for-specific-activity-type-entity\/","title":{"rendered":"Modify OOB ribbon button for Specific Activity Type Entity"},"content":{"rendered":"<p style=\"text-align: justify;\"><strong>Introduction:<\/strong><\/p>\n<p style=\"text-align: justify;\">We recently had a business requirement where we wanted to hide the \u2018Mark Complete\u2019 OOB button from the home page of Activity entity. However, we wanted to hide this button for Service Activity entity and not for other activity types like Task, Appointment, Email, etc.<\/p>\n<p style=\"text-align: justify;\">\u2018Mark Complete\u2019 is a button on the Home Page of Activity entity that allows a user to complete the selected activity. This button is enabled when a user selects any Activity from the grid.<\/p>\n<blockquote>\n<p style=\"text-align: justify;\"><strong><em>Note: The solution mentioned below will apply only for the view of specific entity i.e. Service Activity, Appointment, Task, etc. The solution is not applicable if the user selects the \u2018All Activities\u2019 view.<\/em><\/strong><\/p>\n<\/blockquote>\n<p style=\"text-align: justify;\"><strong>To hide \u2018Mark Complete\u2019 OOB button for Service Activity entity, follow the steps mentioned below;<\/strong><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">1. Open Ribbon Workbench and select the solution, which contains the Activity entity.<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">2. By default, the Command property of the OOB ribbon button is disabled.<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">3. Therefore, first we need to customize the OOB ribbon button. To do this, right click on the \u2018Mark Complete\u2019 OOB ribbon button and select the \u2018Customise Command\u2019 option as seen below;<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\"><img decoding=\"async\" class=\"aligncenter  wp-image-4531\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/02\/Customize-OOB-ribbon-button.png\" alt=\"Customize OOB ribbon button\" width=\"453\" height=\"267\" \/><br \/>\n4. Now add \u2018Enable Rules\u2019 for \u2018Mark Complete\u2019 OOB ribbon button. In the \u2018Enable Rules\u2019, click on \u2018Add Step\u2019 and add \u2018Custom Rule\u2019.<\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">5. Now type the function name and select the JavaScript library. Click on \u2018Add Parameter\u2019 and add CRM Parameter \u2018SelectedEntityTypeName\u2019 in the \u2018Custom Rule\u2019 as shown in the screenshot below;<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter  wp-image-4528\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/02\/Customize-OOB-ribbon-button2-1024x573.jpg\" alt=\"Customize OOB ribbon button\" width=\"731\" height=\"409\" \/><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">6. To achieve the business requirement, we developed a JavaScript function mentioned below;<\/p>\n<pre class=\"lang:default decode:true \">\/\/hideMarkCompleteButton() function is used to show\/hide the \"Mark Complete\" button on activity\r\n\r\nfunction hideMarkCompleteButton(selectedentityName) {\r\n    var functionName = \"hideMarkCompleteButton() \";\r\n    try {\r\n\r\n        if (selectedentityName == \"serviceappointment\") {\r\n            return false;\r\n        } else {\r\n            return true;\r\n        }\r\n    } catch (e) {\r\n        alert(functionName + e.message);\r\n    }\r\n\r\n}\r\n<\/pre>\n<p style=\"text-align: justify; padding-left: 30px;\">7. Add the above created rule into the command of \u2018Mark Complete\u2019 ribbon button as shown in the screenshot below;<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"aligncenter  wp-image-4529\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2017\/02\/Customize-OOB-ribbon-button3.jpg\" alt=\"Customize OOB ribbon button\" width=\"790\" height=\"259\" \/><\/p>\n<p style=\"text-align: justify; padding-left: 30px;\">8. Publish the solution.<\/p>\n<p style=\"text-align: justify;\"><strong>Conclusion:<\/strong><\/p>\n<p style=\"text-align: justify;\">Using Enable Rules, it is possible to override the default behaviour and show\/hide property of ribbon buttons.<\/p>\n<h2 style=\"text-align: left;\"><div class=\"su-heading su-heading-style-default su-heading-align-center\" id=\"\" style=\"font-size:15px;margin-bottom:5px\"><div class=\"su-heading-inner\">One Pic = 1000 words! Analyze data 90% faster with visualization apps!<\/div><\/div><\/h2>\n<p style=\"text-align: left;\"><em>Get optimum visualization of Dynamics 365 CRM data with &#8211;<\/em><br \/>\n<em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/kanban-board-dynamics-365-crm\" target=\"_blank\" rel=\"noopener noreferrer\">Kanban Board<\/a> <\/strong>\u2013 Visualize Dynamics 365 CRM data in Kanban view by categorizing entity records in lanes and rows as per their status, priority, etc.<\/em><br \/>\n<em><strong><a href=\"https:\/\/www.inogic.com\/product\/productivity-apps\/map-my-relationships-dynamics-365-crm\" target=\"_blank\" rel=\"noopener noreferrer\">Map My Relationships<\/a><\/strong> \u2013 Map My Relationships \u2013 Visualize connections and relationships between Dynamics 365 CRM entities or related records in a Mind Map view.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: We recently had a business requirement where we wanted to hide the \u2018Mark Complete\u2019 OOB button from the home page of Activity entity. However, we wanted to hide this button for Service Activity entity and not for other activity types like Task, Appointment, Email, etc. \u2018Mark Complete\u2019 is a button on the Home Page\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2017\/02\/modify-oob-ribbon-button-for-specific-activity-type-entity\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":4527,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15,19,33,49],"tags":[477,1078,1197,1480,1483],"class_list":["post-4530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-dynamics-crm","category-javascript","category-ribbon-buttons","tag-customize-ribbon-button","tag-mark-complete-oob-button","tag-modify-oob-ribbon-button","tag-ribbon-button-customizations","tag-ribbon-workbench-dynamics-crm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4530","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=4530"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/4530\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/4527"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=4530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=4530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=4530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}