{"id":298,"date":"2020-05-21T17:03:38","date_gmt":"2020-05-21T17:03:38","guid":{"rendered":"https:\/\/www.techcrm.in\/blogs\/?p=298"},"modified":"2020-09-08T14:51:15","modified_gmt":"2020-09-08T09:21:15","slug":"how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm","status":"publish","type":"post","link":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/","title":{"rendered":"How to add any field to Mass Update in SugarCRM \/ SuiteCRM"},"content":{"rendered":"\n<p>By default,&nbsp;<strong>SugarCRM \/ SuiteCRM<\/strong>&nbsp;allow to&nbsp;<strong>Mass Update<\/strong>&nbsp;only fields of Data Types:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Checkbox<\/li><li>Datetime<\/li><li>Date<\/li><li>DropDown<\/li><li>Dynamic DropDown<\/li><li>Integer<\/li><li>Multiple Selection<\/li><li>Radio<\/li><\/ul>\n\n\n\n<p>However I found an&nbsp;<strong>\u200bUpgrade-Safe\u200b<\/strong>&nbsp;method to add any field to Mass Update.<\/p>\n\n\n\n<p>First of all, you need to know that for several\u00a0fields\u00a0you&#8217;ll\u00a0not add them to Mass Update from\u00a0<strong>\u200bStudio<\/strong>\u200b, but this can be done only by code.<\/p>\n\n\n\n<p>To do this you should insert a file in&nbsp;<strong>custom\/Extension\/modules\/<em>&lt;modulename&gt;<\/em>\/Ext\/Vardefs<\/strong>&nbsp;with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$dictionary&#91;'&lt;modulename>']&#91;'fields']&#91;'&lt;fieldname>']&#91;'massupdate'] = true;\n?><\/code><\/pre>\n\n\n\n<p>With a &#8220;<strong>Quick Repair and Rebuild<\/strong>&#8220;, this will activate Mass Update for that field,&nbsp;<strong>given that is of one of one of Data Type allowed<\/strong>.<\/p>\n\n\n\n<p>If instead we want, for example,&nbsp;<strong>\u200bto activate Mass Update of a &#8220;TextArea&#8221; field<\/strong>\u200b, we must create a custom versione of the file&nbsp;<strong>include\/MassUpdate.php<\/strong>.<\/p>\n\n\n\n<p>The classic customization with a copy of the file in the &#8220;custom&#8221; folder, in this case it does not works, but we can get it with a slightly more complicated process.<\/p>\n\n\n\n<p>First of all we need to create a CustomMassUpdate.php file that we are able to\u00a0place in\u00a0<strong>custom\/include\/CustomMassUpdate.php<\/strong>.<\/p>\n\n\n\n<p>Inside this file we write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ Extension of class MassUpdate to allow MassUpdate of field of type TextArea\n\nif (! defined('sugarEntry') || ! sugarEntry)\n    die('Not A Valid Entry Point');\n\nrequire_once('include\/MassUpdate.php');\n\nclass CustomMassUpdate extends MassUpdate {\n\n    \/**\n     * Override of this method to allow MassUpdate of field of type TextArea\n     * @param string $displayname field label\n     * @param string $field field name\n     * @param bool $even even or odd\n     * @return string html field data\n     *\/\n    protected function addDefault($displayname, $field, &amp;$even) {\n        if ($field&#91;\"type\"] == 'text') {\n            $even = ! $even;\n            $varname = $field&#91;\"name\"];\n            $displayname = addslashes($displayname);\n            $html = &lt;&lt;&lt;EOQ\n    &lt;td scope=\"row\" width=\"20%\">$displayname&lt;\/td>\n    &lt;td class=\"dataField\" width=\"30%\">&lt;textarea name=\"$varname\" style=\"width: 90%;\" id=\"mass_{$varname}\">&lt;\/textarea>&lt;\/td>\nEOQ;\n            return $html;\n        }\n        else\n            return '';\n    }\n\n}\n?><\/code><\/pre>\n\n\n\n<p>In a similar way we can manage other field types if we need to Mass Update them.<\/p>\n\n\n\n<p>Now we need that our &lt;modulename> uses our custom class instead of the standard one.<\/p>\n\n\n\n<p>To do this we create a file&nbsp;<strong>custom\/include\/CustomListViewSmarty.php<\/strong>&nbsp;and we write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ Extension of class ListViewSmarty to allow MassUpdate of field of type TextArea\n\nif (! defined('sugarEntry') || ! sugarEntry)\n    die('Not A Valid Entry Point');\n\nrequire_once('include\/ListView\/ListViewSmarty.php');\nrequire_once('custom\/include\/CustomMassUpdate.php');\n\nclass CustomListViewSmarty extends ListViewSmarty {\n\n    \/**\n     * @return MassUpdate instance\n     *\/\n    protected function getMassUpdate() {\n        return new CustomMassUpdate();\n    }\n\n}\n?><\/code><\/pre>\n\n\n\n<p>Now the last pass: we should use this class for Mass Update visualization.<\/p>\n\n\n\n<p>Let&#8217;s got create a&nbsp;<strong>custom\/modules\/<em>&lt;modulename&gt;<\/em>\/views\/view.list.php<\/strong>&nbsp;file to extend the standard ViewList class (or it&#8217;s specific version for our module, if it&#8217;s present in&nbsp;<strong>modules\/<em>&lt;modulename&gt;<\/em>\/views\/view.list.php<\/strong>) and we write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/ Extension of classe ListView to allow MassUpdate of field of type TextArea\n\nif (! defined('sugarEntry') || ! sugarEntry)\n    die('Not A Valid Entry Point');\nrequire_once('custom\/include\/CustomListViewSmarty.php');\nclass &lt;modulename>ViewList extends ViewList {\n    function preDisplay() {\n        $this->lv = new CustomListViewSmarty();\n    }\n}?><\/code><\/pre>\n\n\n\n<p>With a &#8220;<strong>Quick Repair and Rebuild<\/strong>&#8220;, our code will start to work and our TextArea field will be added to Mass Update.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note :<\/strong><\/p><cite>1. <em>Here, &lt;modulename&gt; means the module name you see in the URL, for example, Contacts, Leads, Accounts, etc.<\/em><br>2. &lt;fieldname&gt; <em>means anything<\/em> <em>as per your requirements<\/em><\/cite><\/blockquote>\n\n\n\n<p>Hope you find this blog post helpful.<\/p>\n\n\n\n<p>Feel free to add comments and queries, that helps us to improve the quality of posts.<\/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>By default,&nbsp;SugarCRM \/ SuiteCRM&nbsp;allow to&nbsp;Mass Update&nbsp;only fields of Data Types: Checkbox Datetime Date DropDown Dynamic DropDown Integer Multiple Selection Radio However I found an&nbsp;\u200bUpgrade-Safe\u200b&nbsp;method to add any field to Mass Update. First of all, you need to know that for several\u00a0fields\u00a0you&#8217;ll\u00a0not add them to Mass Update from\u00a0\u200bStudio\u200b, but this can be done only by code. [&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":[27,12,13],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-sugarcrm","category-suitecrm","tag-mass-update","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 any field to Mass Update in SugarCRM \/ SuiteCRM - 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-any-field-to-mass-update-in-sugarcrm-suitecrm\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to add any field to Mass Update in SugarCRM \/ SuiteCRM - TechCRM\" \/>\n<meta property=\"og:description\" content=\"By default,&nbsp;SugarCRM \/ SuiteCRM&nbsp;allow to&nbsp;Mass Update&nbsp;only fields of Data Types: Checkbox Datetime Date DropDown Dynamic DropDown Integer Multiple Selection Radio However I found an&nbsp;\u200bUpgrade-Safe\u200b&nbsp;method to add any field to Mass Update. First of all, you need to know that for several\u00a0fields\u00a0you&#8217;ll\u00a0not add them to Mass Update from\u00a0\u200bStudio\u200b, but this can be done only by code. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/\" \/>\n<meta property=\"og:site_name\" content=\"TechCRM\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-21T17:03:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-08T09:21:15+00:00\" \/>\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=\"3 minutes\" \/>\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-any-field-to-mass-update-in-sugarcrm-suitecrm\/\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/\",\"name\":\"How to add any field to Mass Update in SugarCRM \/ SuiteCRM - TechCRM\",\"isPartOf\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\"},\"datePublished\":\"2020-05-21T17:03:38+00:00\",\"dateModified\":\"2020-09-08T09:21:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/#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 any field to Mass Update in SugarCRM \/ SuiteCRM\"}]},{\"@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 any field to Mass Update in SugarCRM \/ SuiteCRM - 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-any-field-to-mass-update-in-sugarcrm-suitecrm\/","og_locale":"en_US","og_type":"article","og_title":"How to add any field to Mass Update in SugarCRM \/ SuiteCRM - TechCRM","og_description":"By default,&nbsp;SugarCRM \/ SuiteCRM&nbsp;allow to&nbsp;Mass Update&nbsp;only fields of Data Types: Checkbox Datetime Date DropDown Dynamic DropDown Integer Multiple Selection Radio However I found an&nbsp;\u200bUpgrade-Safe\u200b&nbsp;method to add any field to Mass Update. First of all, you need to know that for several\u00a0fields\u00a0you&#8217;ll\u00a0not add them to Mass Update from\u00a0\u200bStudio\u200b, but this can be done only by code. [&hellip;]","og_url":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/","og_site_name":"TechCRM","article_published_time":"2020-05-21T17:03:38+00:00","article_modified_time":"2020-09-08T09:21:15+00:00","author":"Navin Rakhonde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Navin Rakhonde","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/","url":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/","name":"How to add any field to Mass Update in SugarCRM \/ SuiteCRM - TechCRM","isPartOf":{"@id":"https:\/\/www.techcrm.in\/blogs\/#website"},"datePublished":"2020-05-21T17:03:38+00:00","dateModified":"2020-09-08T09:21:15+00:00","author":{"@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc"},"breadcrumb":{"@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.techcrm.in\/blogs\/how-to-add-any-field-to-mass-update-in-sugarcrm-suitecrm\/#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 any field to Mass Update in SugarCRM \/ SuiteCRM"}]},{"@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\/298","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=298"}],"version-history":[{"count":3,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":361,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/298\/revisions\/361"}],"wp:attachment":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}