<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Profiling Solutions</title>
	<atom:link href="http://www.profilingsolutions.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.profilingsolutions.com</link>
	<description>SugarCRM and Saleslogix for Atlanta, GA and Mobile, AL</description>
	<lastBuildDate>Tue, 21 Feb 2012 16:46:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Welcome to the Code Sprint</title>
		<link>http://www.profilingsolutions.com/archive/welcome-to-the-code-sprint/</link>
		<comments>http://www.profilingsolutions.com/archive/welcome-to-the-code-sprint/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 16:46:21 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1085</guid>
		<description><![CDATA[This week I&#8217;m attending the SugarCRM Code Sprint at Sugar&#8217;s office in Raleigh, NC. Here&#8217;s the very-nerdy welcome&#8230;]]></description>
			<content:encoded><![CDATA[<p>This week I&#8217;m attending the SugarCRM Code Sprint at Sugar&#8217;s office in Raleigh, NC. Here&#8217;s the very-nerdy welcome&#8230;</p>
<p><img alt="" src="https://p.twimg.com/AmMQWWICEAEs8UA.jpg" title="SugarCRM Code Sprint" class="alignnone" width="600" height="800" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/welcome-to-the-code-sprint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crystal Reports Dynamic Parameters for SalesLogix (and all)</title>
		<link>http://www.profilingsolutions.com/archive/crystal-reports-dynamic-parameters-for-saleslogix-and-all/</link>
		<comments>http://www.profilingsolutions.com/archive/crystal-reports-dynamic-parameters-for-saleslogix-and-all/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 15:58:04 +0000</pubDate>
		<dc:creator>Ron Fisher</dc:creator>
				<category><![CDATA[Lan Customization]]></category>
		<category><![CDATA[SalesLogix]]></category>
		<category><![CDATA[SugarCRM]]></category>
		<category><![CDATA[Web Customization]]></category>
		<category><![CDATA[Crystal Report]]></category>
		<category><![CDATA[Dynamic Parameter]]></category>
		<category><![CDATA[Filter Limit]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1075</guid>
		<description><![CDATA[In Crystal Report Xi one can set up Dynamic Parameter; however there are three limitations to doing so. First there is limit to the number records that can be returned. Second dynamic parameters do not include filters. Lastly, sometimes users want an “All” or “None” feature. 1) Add a registry value to exceed the 1000 [...]]]></description>
			<content:encoded><![CDATA[<p>In Crystal Report Xi one can set up Dynamic Parameter; however there are three limitations to doing so. First there is limit to the number records that can be returned. Second dynamic parameters do not include filters. Lastly, sometimes users want an “All” or “None” feature.</p>
<p>1) Add a registry value to exceed the 1000 record limit<br />
Create a registry key HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 11.0\Crystal Reports\DatabaseOptions\LOV<br />
Then add a string value “MaxRowsetRecords” and set the value to the maximum number of records you would like for your report.</p>
<p>(Counts all parameters..not just each level)</p>
<p>2) Add a dynamic filter w/ ‘…All” as an additional item.</p>
<p>You can set up a command to do this.</p>
<p>In your Database expert there is the Add Command option just above your DB source.</p>
<p>Double click the Add command and put the following code</p>
<p>SELECT FIELD (your vendor field that you want to select from here) FROM table (the table your vendor field is in) UNION SELECT &#8216;&#8230;All&#8217;</p>
<p>Now in your dynamic parameter, reference this Command item instead of field In your Selection Formula use your standard Parameter references</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/crystal-reports-dynamic-parameters-for-saleslogix-and-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sugar Logic Rollups</title>
		<link>http://www.profilingsolutions.com/archive/sugar-logic-rollups/</link>
		<comments>http://www.profilingsolutions.com/archive/sugar-logic-rollups/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 13:22:46 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1063</guid>
		<description><![CDATA[SugarCRM 6.3 introduces a neat new feature of Sugar Logic, the field-calculating excel-style syntax&#8217;d scripting language available inside of Studio. The new rollup feature allows a certain field to gather information from specific fields in related modules. The values can be counted, averaged, summed or we can find the highest (MAX) or lowest (MIN) value [...]]]></description>
			<content:encoded><![CDATA[<p>SugarCRM 6.3 introduces a neat new feature of Sugar Logic, the field-calculating excel-style syntax&#8217;d scripting language available inside of Studio. The new <em>rollup</em> feature allows a certain field to gather information from specific fields in related modules. The values can be counted, averaged, summed or<span id="more-1063"></span> we can find the highest (MAX) or lowest (MIN) value of the fields.</p>
<p>A quick example would be the total number of Cases related to a particular record.</p>
<pre class="brush: plain; title: ; notranslate">count($cases,&quot;amount&quot;)</pre>
<p>From the SugarCRM Developer Blog <a href="http://developers.sugarcrm.com/wordpress/2012/02/13/howto-use-sugar-logic-rollups/" target="_blank">HOWTO: Use Sugar Logic Rollups</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/sugar-logic-rollups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Call to undefined method LoggerManager::getloggerrepository()</title>
		<link>http://www.profilingsolutions.com/archive/call-to-undefined-method-loggermanagergetloggerrepository/</link>
		<comments>http://www.profilingsolutions.com/archive/call-to-undefined-method-loggermanagergetloggerrepository/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 00:46:37 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1059</guid>
		<description><![CDATA[While upgrading an older SugarCRM System from 5.2.0 to 5.5.1, I encountered errors regarding a missing method getloggerrepository(). Searching the SugarCRM forums I quickly found a resolution by modifying some core logger-related files. The fix was simple enough, commenting out a few lines. Follow the instructions provided by SugarCRM Forum Member westphal here in his [...]]]></description>
			<content:encoded><![CDATA[<p>While upgrading an older SugarCRM System from 5.2.0 to 5.5.1, I encountered errors regarding a missing method <em>getloggerrepository()</em>. Searching the SugarCRM forums I quickly found a resolution by modifying some core logger-related files. The fix was simple enough, commenting out a few lines. Follow the instructions provided by SugarCRM Forum Member westphal here in his thread <a href="http://www.sugarcrm.com/forums/f115/resolved-undefined-loggermanager-getloggerrepository-40322/" target="_blank">resolved: undefined LoggerManager::getloggerrepository()</a>.</p>
<blockquote><p>I resolved the issue by commenting the following 5 lines in include/logging.php:</p>
<pre class="brush: php; title: ; notranslate">
if (! isset($simple_log) || $simple_log == false) {
$config = new LoggerPropertyConfigurator();
$config-&gt;configure('log4php.properties');
}</pre>
</blockquote>
<p>From what I can tell, the issue is partly SugarCRM bug in 5.2.0 and/or 5.5.1, and also caused by the outdated version of the Zucker Reports module installed on the system. westphal noted his system had ZuckerReports as well as other modules that used similar methods for interacting with the SugarCRM Logging tools.</p>
<p>It&#8217;s worth noting that attempting to simply uninstall Zucker won&#8217;t solve the problem, because Module Loader will fail due to the same Logger references that trip up Repair &#038; Rebuild. </p>
<p>After applying westphal&#8217;s fix, removing Zucker, and a Repair &#038; Rebuild, the system was stable at 5.5.1 and I was able to continue my upgrade. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/call-to-undefined-method-loggermanagergetloggerrepository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logic Hook Field-Change Detection, $bean-&gt;$field vs $bean-&gt;fetched_row[$field]</title>
		<link>http://www.profilingsolutions.com/archive/sugarcrm-field-change-detection-fetched-row/</link>
		<comments>http://www.profilingsolutions.com/archive/sugarcrm-field-change-detection-fetched-row/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 19:08:17 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1010</guid>
		<description><![CDATA[SugarCRM Logic Hooks are a powerful way of interacting with data or other systems on specific system actions, usually retrieving or saving a record. A common customization challenge we face is saving a record and performing an action if a particular field has changed. For example, if a phone number field changes for a contact, [...]]]></description>
			<content:encoded><![CDATA[<p>SugarCRM Logic Hooks are a powerful way of interacting with data or other systems on specific system actions, usually retrieving or saving a record. A common customization challenge we face is saving a record and performing an action <em>if a particular field has changed</em>. For example, if a phone number field changes for a contact, we want to merge the updated contact record with another system via an API. Let&#8217;s look at how to detect changes.<span id="more-1010"></span></p>
<p>Logic hooks are well enough explained in the <a href="http://developers.sugarcrm.com/docs/OS/6.3/Developer_Guides/-docs-Developer_Guides-Sugar_Developer_Guide_6.3.0-Sugar_Developer_Guide_6.3.0.html#9003754" target="_blank">Developer Guide</a> and other sites like <a href="http://cheleguanaco.blogspot.com/2009/06/simple-sugarcrm-logic-hook-example.html" target="_blank">Angel Magaña&#8217;s Simple SugarCRM Logic Hook Example</a>. I won&#8217;t explain them in-depth here. What I want to get into is detecting changes on key fields. That said, here&#8217;s an example of a logic hook that does just that:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
class DataSync{
	/*
	 * The method that does the checking for the specific fields. This is
	 * the method that we'll want to call in the logic_hooks.php file.
	 */
	function CheckUpdatedFields($bean, $event, $arguments){
		// if there are more than one field you're interested in, use an array
		$key_fields = array('phone_home','phone_other','phone_work');
		// and cycle through them
		foreach($key_fields as $key_field){
			// do a change detection leveraging the fetched_row value
			if($bean-&gt;$key_field != $bean-&gt;fetched_row[$key_field]{
				// and if a change is detected, queue up the Sync method
				$this-&gt;SyncToSystem($bean,$key_field);
			}
		}
	}

	/*
	 * A Generic Placeholder function, to be called when a change is detected
	 */
	function SyncToSystem($bean,$field){
		// placeholder
		return true;
	}
}
</pre>
<p>This hook is doing the change-detection by leveraging the <strong>$bean-&gt;fetched_row</strong> value. fetched_row holds the information from the database that was originally retrieved. This works in a <em>before_save</em> logic hook, because the database value hasn&#8217;t yet been updated, but the $bean-&gt;$field itself has been changed. Comparing the live value ($bean-&gt;$field) and the stored database value (in $bean-&gt;fetched_row[$field]) will show whether or not that field has been modified.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/sugarcrm-field-change-detection-fetched-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differences in Saleslogix Web and LAN Experiences</title>
		<link>http://www.profilingsolutions.com/archive/differences-in-saleslogix-web-lan/</link>
		<comments>http://www.profilingsolutions.com/archive/differences-in-saleslogix-web-lan/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 13:15:35 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[Lan Customization]]></category>
		<category><![CDATA[SalesLogix]]></category>
		<category><![CDATA[Web Customization]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1055</guid>
		<description><![CDATA[A great question and conversation popped up recently on the LinkedIn message board for the Sage Saleslogix group. Ron from Profiling Solutions weighs in with other Sage community members to help shed light on the differences between using Saleslogix Web versus Saleslogix LAN client. LinkedIn Discussion (note that you must be logged in to LinkedIn [...]]]></description>
			<content:encoded><![CDATA[<p>A great question and conversation popped up recently on the LinkedIn message board for the Sage Saleslogix group. Ron from Profiling Solutions weighs in with other Sage community members to help shed light on the differences between using Saleslogix Web versus Saleslogix LAN client.</p>
<p><a href="http://www.linkedin.com/groupItem?view=&#038;gid=1914069&#038;type=member&#038;item=79445923&#038;qid=cdab1f9e-fdd4-4fd5-97e4-c6c05d6fdad5" target="_blank">LinkedIn Discussion</a> (note that you must be logged in to LinkedIn and join the Sage Saleslogix group to read and participate). <span id="more-1055"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/differences-in-saleslogix-web-lan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SalesLogix Advanced Analytics : Unable to Open Tibco Spotfire Professional Client During Install</title>
		<link>http://www.profilingsolutions.com/archive/saleslogix-advanced-analytics-unable-to-open-tibco-spotfire-professional-client-during-install/</link>
		<comments>http://www.profilingsolutions.com/archive/saleslogix-advanced-analytics-unable-to-open-tibco-spotfire-professional-client-during-install/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 18:40:37 +0000</pubDate>
		<dc:creator>Ron Fisher</dc:creator>
				<category><![CDATA[Advanced Analytics]]></category>
		<category><![CDATA[SalesLogix]]></category>
		<category><![CDATA[Web Customization]]></category>
		<category><![CDATA[Sage SalesLogix]]></category>
		<category><![CDATA[Spotfire]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1051</guid>
		<description><![CDATA[Following the Sage SalesLogix Advanced Analytics Installation Guide, I was stymied in logging into the Professional Client during the step: Testing the custom authentication. What was happening during Configuring the Spotfire Server for Sage SalesLogix? In this step one sets up: Authentication Tab Data Source Templates tab User Directory Tab Impersonation Tab Login Behavior tab [...]]]></description>
			<content:encoded><![CDATA[<p>Following the Sage SalesLogix Advanced Analytics Installation Guide, I was stymied in logging into the Professional Client during the step: <em>Testing the custom authentication</em>.</p>
<p>What was happening during Con<em>figuring the Spotfire Server for Sage SalesLogix</em>?</p>
<p>In this step one sets up:</p>
<p>Authentication Tab</p>
<p>Data Source Templates tab</p>
<p>User Directory Tab</p>
<p>Impersonation Tab</p>
<p>Login Behavior tab</p>
<p>All of these set up values are pretty easy except for the Authentication Tab.  This requires typing the connection string.</p>
<p align="left">The name pair value consists  of :  </p>
<ul>
<li>
<div align="left">custom.db.connection</div>
</li>
<li>
<div align="left">jdbc:jtds:sqlserver://&lt;database server&gt;:&lt;port&gt;/&lt;Sage SalesLogix Database name&gt;</div>
</li>
</ul>
<p>This should be fairly simple</p>
<p>jdbc:jtds:sqlserver://SQLServername/SQLInstance:1433/SalesLogixEval</p>
<p>In turns out that the jdbc connection does NOT recognize the SQLInstance name.  The perils of using SQLExpress with a SQL Instance.</p>
<p>jdbc:jtds:sqlserver://SQLServername:1433/SalesLogixEval</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/saleslogix-advanced-analytics-unable-to-open-tibco-spotfire-professional-client-during-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not load file or assembly &#8216;dtSearchNetApi2&#8242; or one of its dependencies</title>
		<link>http://www.profilingsolutions.com/archive/could-not-load-file-or-assembly-dtsearchnetapi2-or-one-of-its-dependencies/</link>
		<comments>http://www.profilingsolutions.com/archive/could-not-load-file-or-assembly-dtsearchnetapi2-or-one-of-its-dependencies/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 18:23:21 +0000</pubDate>
		<dc:creator>Ron Fisher</dc:creator>
				<category><![CDATA[SalesLogix]]></category>
		<category><![CDATA[Web Customization]]></category>
		<category><![CDATA[dtSearchNetApi2]]></category>
		<category><![CDATA[SalesLogix Web Login]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1047</guid>
		<description><![CDATA[If running SalesLogix on a Win64 bit machine with IIS7, go to the Classic Application Pool. Choose Advanced Settings Change the Enable 32 Bit from False to True]]></description>
			<content:encoded><![CDATA[<p>If running SalesLogix on a Win64 bit machine with IIS7, go to the Classic Application Pool.</p>
<p>Choose Advanced Settings</p>
<p>Change the Enable 32 Bit from False to True</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/could-not-load-file-or-assembly-dtsearchnetapi2-or-one-of-its-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SugarCRM Module Bare-bone Manifest File</title>
		<link>http://www.profilingsolutions.com/archive/sugarcrm-module-bare-bone-manifest-file/</link>
		<comments>http://www.profilingsolutions.com/archive/sugarcrm-module-bare-bone-manifest-file/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 14:49:45 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1018</guid>
		<description><![CDATA[For our ongoing projects, sometimes we need to upload customizations to key files that don&#8217;t necessarily invoice creating new modules or fields. They&#8217;re just code changes. I&#8217;ve been using and re-using this manifest.php for such situations for a few months now and it seems to work nicely. When I need it, I copy the file [...]]]></description>
			<content:encoded><![CDATA[<p>For our ongoing projects, sometimes we need to upload customizations to key files that don&#8217;t necessarily invoice creating new modules or fields. They&#8217;re just code changes. I&#8217;ve been using and re-using this <a href="http://developers.sugarcrm.com/docs/OS/6.3/-docs-Developer_Guides-Sugar_Developer_Guide_6.3.0-Sugar_Developer_Guide_6.3.0.html#9003445" target="_blank">manifest.php</a> for such situations for a few months now and it seems to work nicely.</p>
<p>When I need it, I copy the file from an old module and paste it into my current directory. <span id="more-1018"></span>I adjust the description, name (PSI for Profiling Solutions, and the year-month-dayofmonth), published date<a href="#disclosure-manifest">*</a> and id (same as the name). Install defs is set to copy everything from the package&#8217;s <em>custom/</em> directory into the SugarCRM custom directory, overwriting whatever is there along the way.</p>
<p>It&#8217;s quick and clean, ideal for ongoing projects. I&#8217;ll have several packages kept in the SugarCRM root directory of the project, each directory and modularized ZIP named the same as $manifest ['name'] for quick identification.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$manifest = array (
	'acceptable_sugar_versions' =&gt; array (),
	'acceptable_sugar_flavors' =&gt; array(),
	'readme'=&gt;'',
	'key'=&gt;'PSI',
	'author' =&gt; 'Profiling Solutions, Inc.',
	'description' =&gt; 'adjust quote-to-opp conversion and updates',
	'icon' =&gt; '',
	'is_uninstallable' =&gt; true,
	'name' =&gt; 'PSI_20120120',
	'published_date' =&gt; '2012-01-20 10:05:57',
	'type' =&gt; 'module',
	'version' =&gt; '1.0',
);
$installdefs = array(
	'id' =&gt; 'PSI_20120120',
	'copy' =&gt; array (
		array (
			'from' =&gt; '&lt;basepath&gt;/custom',
			'to' =&gt; 'custom',
		),
	),
);</pre>
<p><a id="disclosure-manifest" name="disclosure-manifest"></a>* Full disclosure: Sometimes I only adjust the date part of <em>published_date</em>, and don&#8217;t even touch the time portion! We rarely upload more than one package in a day so I get away with it. <a href="#wrapper">Scroll back to the top</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/sugarcrm-module-bare-bone-manifest-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating SugarCRM Fields through Code</title>
		<link>http://www.profilingsolutions.com/archive/creating-sugarcr-fields-through-code/</link>
		<comments>http://www.profilingsolutions.com/archive/creating-sugarcr-fields-through-code/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 13:01:57 +0000</pubDate>
		<dc:creator>Matthew Poer</dc:creator>
				<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://www.profilingsolutions.com/?p=1001</guid>
		<description><![CDATA[SugarCRM&#8217;s Studio tool is great for administrators to point-and-click their way into field creation, but there are alternative methods. Creating fields in code has the advantage of gaining 100% control of the field, which can be especially helpful if you desired, for instance, multiple Flex Relate fields. You also gain the ability to keep the [...]]]></description>
			<content:encoded><![CDATA[<p>SugarCRM&#8217;s Studio tool is great for administrators to point-and-click their way into field creation, but there are alternative methods. Creating fields in code has the advantage of gaining 100% control of the field, which can be especially helpful if you desired, for instance, multiple Flex Relate fields. You also gain the ability to keep the field under version control.<span id="more-1001"></span></p>
<p>In current versions of SugarCRM, information about custom fields on stock modules is scattered in several places. In the process of creating a new text-input field for Accounts called &#8220;Certifications,&#8221; we would find that the following would take place</p>
<ul>
<li>a file created at <strong>/custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_certifications_c.php</strong> that held some, but not all, of the advanced vardef information (e.g. SugarLogic)</li>
<li>after the repair-and-rebuild of the system (which Studio will automatically call), the data from the above file is compiled (with other custom Vardefs, if they are present) into <strong>/custom/modules/Accounts/Ext/Vardefs/vardefs.ext.php</strong>.</li>
<li>the file at <strong>/custom/modules/Accounts/language/en_us.lang.php</strong> was created or modified with the language data for the Certification field</li>
<li>the database table <em>accounts_cstm</em> was created or modified to include a <strong>certifications_c</strong> field.</li>
<li>data was inserted into the the database table <em>fields_meta_data</em> containing the vardef data for the field.</li>
</ul>
<p>However, suppose we created the vardef file ourselves? And the language file? We can actually author the entire vardef, specifying field names (ever wanted to drop the <em>_c</em> suffix? Maybe for some <a title="Custom Address Fields" href="http://www.profilingsolutions.com/archive/custom-address-fields/" target="_blank">address fields</a>?). By doing so, we get the entire thing under our preferred <abbr title="Version Control System">VCS</abbr>. It&#8217;s as straight-forward as creating the full field definition array in the first file location. The dificulty for some will come in the database. When you attempt your repair-and-rebuild, SugarCRM will find a vardef that isn&#8217;t defined in metadata, and so will incorrectly assume that the field should be appended to the default table (i.e. <em>accounts</em> instead of <em>accounts_cstm</em>). While this works, it&#8217;s less upgrade-safe than using the <em>_cstm</em> table.</p>
<p>Let&#8217;s go start-to-finish for our Certifications field.</p>
<p>Create the file <strong>/custom/Extension/modules/Accounts/Ext/Vardefs/sugarfield_certifications_c.php</strong> with the following contents:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$dictionary['Account']['fields']['certification_c'] = array(
    'name' =&gt; 'certification_c',
    'vname' =&gt; 'LBL_CERTIFICATION_C',
    'type' =&gt; 'varchar',
    'len' =&gt; '255',
    'audited'=&gt;false,
    'required'=&gt;false,
    'comment' =&gt; 'List Certification'
);</pre>
<p>This definition is pretty bare-bones, but that&#8217;s because we&#8217;re using a text field. If you used an enum (dropdown) field type, then you&#8217;d be sure to specify the <em>options</em> parameter, and there are several more parameters involving reporting and searching. For a better understanding of the parameters for a particular field type or function, the trick is to find an existing field of the type or function in the system and track down it&#8217;s vardefs, usually somewhere like /modules/Accounts/vardefs.php. </p>
<p>That handles the vardefs, so let&#8217;s do the same for the relevant language strings. Studio places the language strings it creates in /custom/modules/Accounts/language/en_us.lang.php, but repair-rebuild will do something similar function. Let&#8217;s stick with our top-level Extension directory. Create the file <strong>/custom/Extension/modules/Accounts/Ext/Language/en_us.certifications_c.php</strong> (be sure you have your en_us or language-specific prefix) with the following line:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$mod_strings['LBL_CERTIFICATION_C'] = 'Certifications';</pre>
<p>The field and it&#8217;s label are defined in the system, but before we run our repair-and-rebuild to activate it, we need to set up the database. We&#8217;ll a SQL statement to add the data to fields_meta_data. </p>
<pre class="brush: sql; title: ; notranslate">INSERT INTO fields_meta_data (id,name,vname,comments,custom_module,type,len,required,deleted,audited,massupdate,duplicate_merge,reportable,importable) VALUES ('Accountscertification_c','certification_c','LBL_CERTIFICATION_C','List Certification','Accounts','varchar',255,0,0,0,0,0,1,0);</pre>
<p>Like the vardef itself, this query varies depending on field type. The fields match pretty closely to the vardef itself so you should be able to decipher basic fields. </p>
<p>Now that we have everything defined in the system, similarly but more-so to what Studio would generate for us, we can run repair-and-rebuild. RaR will notice that the actual field hasn&#8217;t been set up on accounts_cstm yet, and so will prompt you to do so (providing the query). </p>
<pre class="brush: sql; title: ; notranslate">/*Checking Custom Fields for module : Accounts */
CREATE TABLE accounts_cstm ( id_c char(36) NOT NULL, PRIMARY KEY ( id_c ) ) CHARACTER SET utf8 COLLATE utf8_general_ci;
/*MISSING IN DATABASE - certification_c -  ROW*/
alter table accounts_cstm add column certification_c varchar(255)  NULL ;
</pre>
<p>If you already have custom fields for Accounts, the CREATE statement won&#8217;t show up, only the ALTER statement. Once you execute the statement, you&#8217;ll be informed that <a href="http://www.profilingsolutions.com/wp-content/uploads/2012/01/DatabaseTablesAreSyncedWithVardefs.png"><img src="http://www.profilingsolutions.com/wp-content/uploads/2012/01/DatabaseTablesAreSyncedWithVardefs.png" alt="Database Tables Are Synced With Vardefs" title="Database Tables Are Synced With Vardefs" width="645" height="152" class="alignnone size-full wp-image-1004" /></a></p>
<p>Your field will then be accessible for use, and you can add it to your views via Studio or via code as normal.</p>
<h3>A Note About the Future</h3>
<p>SugarCRM announced in a recent community webinar that an goal for the system will be to do away with <em>fields_meta_data</em> and ensure that more aspects of the system are being controlled through code, instead of the current hybrid setup. At that point, there will be one less step in this process.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.profilingsolutions.com/archive/creating-sugarcr-fields-through-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

