{"id":136,"date":"2019-08-25T07:46:32","date_gmt":"2019-08-25T07:46:32","guid":{"rendered":"https:\/\/www.techcrm.in\/blogs\/?p=136"},"modified":"2020-09-08T14:55:35","modified_gmt":"2020-09-08T09:25:35","slug":"mass-convert-targets-to-leads","status":"publish","type":"post","link":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/","title":{"rendered":"Mass convert Targets to Leads"},"content":{"rendered":"\n<p>Another interesting question on SugarCRM Forum attracted me to implement the request and here I go and write the solution for it. <\/p>\n\n\n\n<p>Steps are as below,<\/p>\n\n\n\n<p><strong>Step 1<\/strong>: Create a flag field which allows you to mass convert Targets.<\/p>\n\n\n\n<p>Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Vardefs\/&lt;any_name>.php and write following code in it. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php \n$dictionary['Prospect']['fields']['convert_prospect'] = array('name' => 'convert_prospect',\n    'vname' => 'LBL_CONVERT_PROSPECT',\n    'type' => 'bool',\n    'default' => '0',\n    'massupdate' => true,\n    );<\/code><\/pre>\n\n\n\n<p>Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Language\/en_us.&lt;any_name>.php and write following code. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$mod_strings['LBL_CONVERT_PROSPECT'] => 'Convert Leads';<\/code><\/pre>\n\n\n\n<p>Then do Quick Repair and Rebuild which will give you a query to add a new field in prospects table.<\/p>\n\n\n\n<p><strong>Step 2<\/strong>: Create a before_save logic hook in Prospects module.<\/p>\n\n\n\n<p>Create a file logic_hooks.php under custom\/modules\/Prospects if doesn&#8217;t exist, or else add following code in it. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php \n$hook_array['before_save'][] = Array(1, 'Mass Convert Prospects into Leads', 'custom\/modules\/Prospects\/convertIntoLeads.php','convertIntoLeadsC', 'convertIntoLeadsF');<\/code><\/pre>\n\n\n\n<p><strong>Step 3<\/strong>: Lets add logic behind.<\/p>\n\n\n\n<p>Create a file convertIntoLeads.php under custom\/modules\/Prospects and add following code which copies the values from Prospect and creates a new lead. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php \nclass convertIntoLeadsC {\n    function convertIntoLeadsF($bean, $event, $args) {\n        if (isset($bean->convert_prospect) &amp;&amp; $bean->convert_prospect != $bean->fetched_row['convert_prospect'] &amp;&amp; empty($bean-&gt;lead_id)) {\n            $oLead = new Lead();\n            foreach ($oLead->field_defs as $keyField => $aFieldName) {\n                $oLead->$keyField = $bean->$keyField;\n            }\n            $oLead->id = '';\n            $oLead->save(true);\n            $bean->lead_id = $oLead->id;\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Now go to List View of Prospects and select the records you want to convert into Leads and mass update them by selecting Convert to Leads &#8220;Yes&#8221;.<\/p>\n\n\n\n<p>That&#8217;s all! All selected Prospects are now converted into Leads!! <\/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> This feature will allow all users to convert Targets into Leads. <\/cite><\/blockquote>\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>Another interesting question on SugarCRM Forum attracted me to implement the request and here I go and write the solution for it. Steps are as below, Step 1: Create a flag field which allows you to mass convert Targets. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Vardefs\/&lt;any_name>.php and write following code in it. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Language\/en_us.&lt;any_name>.php [&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-136","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>Mass convert Targets to Leads - 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\/mass-convert-targets-to-leads\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mass convert Targets to Leads - TechCRM\" \/>\n<meta property=\"og:description\" content=\"Another interesting question on SugarCRM Forum attracted me to implement the request and here I go and write the solution for it. Steps are as below, Step 1: Create a flag field which allows you to mass convert Targets. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Vardefs\/&lt;any_name&gt;.php and write following code in it. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Language\/en_us.&lt;any_name&gt;.php [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/\" \/>\n<meta property=\"og:site_name\" content=\"TechCRM\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-25T07:46:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-08T09:25:35+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/\",\"url\":\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/\",\"name\":\"Mass convert Targets to Leads - TechCRM\",\"isPartOf\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#website\"},\"datePublished\":\"2019-08-25T07:46:32+00:00\",\"dateModified\":\"2020-09-08T09:25:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/#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\":\"Mass convert Targets to Leads\"}]},{\"@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":"Mass convert Targets to Leads - 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\/mass-convert-targets-to-leads\/","og_locale":"en_US","og_type":"article","og_title":"Mass convert Targets to Leads - TechCRM","og_description":"Another interesting question on SugarCRM Forum attracted me to implement the request and here I go and write the solution for it. Steps are as below, Step 1: Create a flag field which allows you to mass convert Targets. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Vardefs\/&lt;any_name>.php and write following code in it. Create a file under custom\/Extension\/modules\/Prospects\/Ext\/Language\/en_us.&lt;any_name>.php [&hellip;]","og_url":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/","og_site_name":"TechCRM","article_published_time":"2019-08-25T07:46:32+00:00","article_modified_time":"2020-09-08T09:25:35+00:00","author":"Navin Rakhonde","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Navin Rakhonde","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/","url":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/","name":"Mass convert Targets to Leads - TechCRM","isPartOf":{"@id":"https:\/\/www.techcrm.in\/blogs\/#website"},"datePublished":"2019-08-25T07:46:32+00:00","dateModified":"2020-09-08T09:25:35+00:00","author":{"@id":"https:\/\/www.techcrm.in\/blogs\/#\/schema\/person\/992dfe427bb53dcdfd72dd80e3ef9dbc"},"breadcrumb":{"@id":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.techcrm.in\/blogs\/mass-convert-targets-to-leads\/#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":"Mass convert Targets to Leads"}]},{"@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\/136","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=136"}],"version-history":[{"count":1,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/136\/revisions"}],"predecessor-version":[{"id":137,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/posts\/136\/revisions\/137"}],"wp:attachment":[{"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/media?parent=136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/categories?post=136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcrm.in\/blogs\/wp-json\/wp\/v2\/tags?post=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}