{"id":206,"date":"2019-10-02T17:14:40","date_gmt":"2019-10-02T17:14:40","guid":{"rendered":"https:\/\/www.techcrm.in\/blogs\/?p=206"},"modified":"2020-09-08T14:53:10","modified_gmt":"2020-09-08T09:23:10","slug":"how-to-add-custom-actions","status":"publish","type":"post","link":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/","title":{"rendered":"How To Add Custom Actions\/Views"},"content":{"rendered":"\n<p>Besides the default actions such as EDIT, DETAIL, LIST; we can add extra custom actions for any modules. This article shows you the steps to do that. <\/p>\n\n\n\n<p> Add a custom action for the &lt;desired_module> module. Firstly, you have to create a file controller.php in the following directory.<\/p>\n\n\n\n<p>Steps are as below,<\/p>\n\n\n\n<p><strong>Step 1:<\/strong>  create  file in custom\/modules\/&lt;desired_module>controller.php and add below code.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\nrequire_once('include\/MVC\/Controller\/SugarController.php');\n\nclass &lt;desired_module>Controller extends SugarController {\n    \n function action_&lt;desired_action_name>(){\n $this->view = '&lt;desired_view_name>';\n }\n}\n?><\/pre>\n\n\n\n<p><strong>Step :2<\/strong>  Create file  in custom\/modules\/ &lt;desired_module>\/views\/view.&lt;desired_view_name>.php and add below code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nif(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');\n\nrequire_once('include\/MVC\/View\/views\/view.detail.php');\n\nclass View&lt;desired_view_name> extends ViewDetail {\n\n\tfunction View&lt;desired_view_name>(){\n\t\tparent::ViewDetail();\n\t}\n\t\n\tfunction display() {\n\t\techo \"hello\";\n\t}\n}\n\n?><\/code><\/pre>\n\n\n\n<p><strong>Step 3:<\/strong>  Copy your include\/MVC\/Controller\/action_view_map.php file to custom\/ include\/MVC\/Controller\/action_view_map.php and add below code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$action_view_map['&lt;desired_action_name>'] = &lt;desired_view_name>;<\/code><\/pre>\n\n\n\n<p><strong>Step 4:<\/strong>\u00a0Do Quick Repair and Rebuild <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Note:<\/p><cite><em>Here, &lt;desired_module> means the module name you see in the URL, for example, Contacts, Leads, etc.<br>Here, &lt; desired_view_name > means the any view name\u00a0for example, custom_view, etc.<br>Here, &lt;desired_action_name> means module object\u00a0for example custom_action, etc. <\/em><\/cite><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"184\" src=\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg\" alt=\"\" class=\"wp-image-207\"\/><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"135\" src=\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-8.jpg\" alt=\"\" class=\"wp-image-208\"\/><figcaption>After Customization <\/figcaption><\/figure><\/div>\n\n\n\n<p>Hope this helps and feels like missing piece is just found!<\/p>\n\n\n\n<p>Feel free to drop your comments.<\/p>\n\n\n\n<p>Your valuable feedback means a lot.<\/p>\n\n\n\n<p>You can contact us at&nbsp;<a rel=\"noreferrer noopener\" href=\"mailto:contact@urdhva-tech.com\" target=\"_blank\">info@techcrm.in<\/a><\/p>\n\n\n\n<p>Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Besides the default actions such as EDIT, DETAIL, LIST; we can add extra custom actions for any modules. This article shows you the steps to do that. Add a custom action for the &lt;desired_module> module. Firstly, you have to create a file controller.php in the following directory. Steps are as below, Step 1: create file [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,9],"tags":[12,13],"class_list":["post-206","post","type-post","status-publish","format-standard","hentry","category-sugarcrm","category-suitecrm","tag-sugarcrm","tag-suitecrm"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Add Custom Actions\/Views - TechCRM<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Add Custom Actions\/Views - TechCRM\" \/>\n<meta property=\"og:description\" content=\"Besides the default actions such as EDIT, DETAIL, LIST; we can add extra custom actions for any modules. This article shows you the steps to do that. Add a custom action for the &lt;desired_module&gt; module. Firstly, you have to create a file controller.php in the following directory. Steps are as below, Step 1: create file [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/\" \/>\n<meta property=\"og:site_name\" content=\"TechCRM\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-02T17:14:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-08T09:23:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg\" \/>\n<meta name=\"author\" content=\"Navin Rakhonde\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Navin Rakhonde\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/\",\"name\":\"How To Add Custom Actions\/Views - TechCRM\",\"isPartOf\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg\",\"datePublished\":\"2019-10-02T17:14:40+00:00\",\"dateModified\":\"2020-09-08T09:23:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg\",\"contentUrl\":\"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.techcrm.in\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SugarCRM\",\"item\":\"https:\/\/www.techcrm.in\/blogs\/category\/sugarcrm\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Add Custom Actions\/Views\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/\",\"name\":\"TechCRM\",\"description\":\"Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.techcrm.in\/blogs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\",\"name\":\"Navin Rakhonde\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g\",\"caption\":\"Navin Rakhonde\"},\"sameAs\":[\"https:\/\/www.techcrm.in\/\"],\"url\":\"https:\/\/www.techcrm.in\/blogs\/author\/navin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Add Custom Actions\/Views - TechCRM","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/","og_locale":"en_US","og_type":"article","og_title":"How To Add Custom Actions\/Views - TechCRM","og_description":"Besides the default actions such as EDIT, DETAIL, LIST; we can add extra custom actions for any modules. This article shows you the steps to do that. Add a custom action for the &lt;desired_module> module. Firstly, you have to create a file controller.php in the following directory. Steps are as below, Step 1: create file [&hellip;]","og_url":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/","og_site_name":"TechCRM","article_published_time":"2019-10-02T17:14:40+00:00","article_modified_time":"2020-09-08T09:23:10+00:00","og_image":[{"url":"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg"}],"author":"Navin Rakhonde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Navin Rakhonde","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/","url":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/","name":"How To Add Custom Actions\/Views - TechCRM","isPartOf":{"@id":"https:\/\/www.techcrm.in\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage"},"image":{"@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg","datePublished":"2019-10-02T17:14:40+00:00","dateModified":"2020-09-08T09:23:10+00:00","author":{"@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc"},"breadcrumb":{"@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#primaryimage","url":"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg","contentUrl":"https:\/\/www.techcrm.in\/blogs\/wp-content\/uploads\/2019\/10\/sshot-7.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-custom-actions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.techcrm.in\/blogs\/"},{"@type":"ListItem","position":2,"name":"SugarCRM","item":"https:\/\/www.techcrm.in\/blogs\/category\/sugarcrm\/"},{"@type":"ListItem","position":3,"name":"How To Add Custom Actions\/Views"}]},{"@type":"WebSite","@id":"https:\/\/www.techcrm.in\/blogs\/#website","url":"https:\/\/www.techcrm.in\/blogs\/","name":"TechCRM","description":"Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.techcrm.in\/blogs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc","name":"Navin Rakhonde","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cc8fd1b948255055b85e5d41dabfc6e704f806d180a1e21cb8fb378e2f5c022?s=96&d=mm&r=g","caption":"Navin Rakhonde"},"sameAs":["https:\/\/www.techcrm.in\/"],"url":"https:\/\/www.techcrm.in\/blogs\/author\/navin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/comments?post=206"}],"version-history":[{"count":2,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":210,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/206\/revisions\/210"}],"wp:attachment":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/media?parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/categories?post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/tags?post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}