<?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>The Enforcer.net &#187; campaigns</title>
	<atom:link href="http://theEnforcer.net/category/campaigns/feed/" rel="self" type="application/rss+xml" />
	<link>http://theEnforcer.net</link>
	<description>a force.com blog</description>
	<lastBuildDate>Mon, 31 Oct 2011 22:55:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Loading Contacts into Campaigns</title>
		<link>http://theEnforcer.net/2008/08/loading-contacts-into-campaigns/</link>
		<comments>http://theEnforcer.net/2008/08/loading-contacts-into-campaigns/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 05:28:22 +0000</pubDate>
		<dc:creator>The Enforcer</dc:creator>
				<category><![CDATA[Data Loader]]></category>
		<category><![CDATA[campaigns]]></category>

		<guid isPermaLink="false">http://theenforcer.net/?p=50</guid>
		<description><![CDATA[Today I had to create campaigns to track Trade Show attendees. I&#8217;ve written previously about creating campaigns from Webex attendee files, but my Trade Show source files were not as friendly. Each Trade Show organiser gave us lists in different formats — the best one contained complete Name, Address, Company, Title and Email information, while [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to create campaigns to track <strong>Trade Show attendees</strong>. I&#8217;ve <a href="http://theenforcer.net/2008/07/webex/">written previously</a> about creating campaigns from Webex attendee files, but my Trade Show source files were not as friendly. Each Trade Show organiser gave us lists in <strong>different formats</strong> — the best one contained complete Name, Address, Company, Title and Email information, while the worst had just First Name and Email (yes, really!).</p>
<p>My requirements were:</p>
<ul>
<li>Load information from <strong>disparate source documents</strong></li>
<li>Create <strong>Contacts</strong>, not Leads (we don&#8217;t use Leads)</li>
<li><strong>Don&#8217;t overwrite</strong> existing Contact records (existing customers are populated from an External system, with more accurate information than Trade Show visitor data)</li>
<li>Add them to a <strong>Campaign</strong> for tracking purposes</li>
</ul>
<h3>Importing Contacts</h3>
<p>The first step was quite easy with the help of the <strong>Salesforce.com Data Loader</strong> (known as <strong>LexiLoader</strong> on the Mac). It can import Contact records from a CSV file. The trick here, however, was to use <strong>INSERT rather than UPSERT</strong>. My system is configured to <a href="http://theenforcer.net/2008/08/using-email-as-an-external-id-for-contacts/">use Email as an External ID for Contacts</a>, so the import will fail for records where there is an existing Contact with the same Email address. This is good — it lets me create new records only where the Contact already does not exist.</p>
<p>Also as part of the import, I added a column for <strong>RecordTypeId</strong>. This is because I have two Record Types for my contacts:</p>
<ul>
<li><strong>Manually</strong> created contacts (which let users edit most fields) — this is the one I selected, and</li>
<li><strong>Automatically</strong> created contacts (which come from my external system, and don&#8217;t let users edit fields since they are slaved from my external system)</li>
</ul>
<p>I also added a column for <strong>AccountId</strong>, which is quite important. Any Contact records that aren&#8217;t linked to an Account are only visible to the record creator. In our case, we don&#8217;t actually use Accounts (I&#8217;ll blog about that in future), so I just linked all the new Contacts to a &#8216;Default Account&#8217; to make them visible.</p>
<h3>Adding Contacts to Campaigns</h3>
<p>There&#8217;s lots of ways to add Campaign Members to Campaigns, either from Lead/Contact records or from the Campaign record. In this case, I wanted to add them in bulk, so I used the <strong>Manage Members</strong> button:</p>
<p><img class="aligncenter" title="Manage Members" src="http://theenforcer.net/wp-content/uploads/2008/08/managecampaigns.png" alt="" width="576" height="258" /></p>
<p>To load in bulk, I wanted to use an &#8220;Import File&#8221; capability, but I didn&#8217;t want to load Leads. So, the <strong>Add Members &#8211; Import File</strong> option was no good, since it only loads records as Leads. Instead, I used the <strong>Update Status &#8211; Import File</strong> option which can not only <strong>update</strong> a status, but also <strong>associate a Contact with a Campaign</strong>. In other words, it can take existing Contacts and add them to a Campaign — Perfect!</p>
<p>Unfortunately, <strong>Import File</strong> wants a file that contains the <strong>Salesforce Contact ID</strong>. This is a problem, since the ID is generated within the Force.com platform and is not in my CSV file. The online hints for that command suggest creating a Report on campaign members, saving as CSV then importing them to change the status. This is not an option for me since some of the people are already in Salesforce.com as existing Contacts and others I&#8217;ve just created. So, there&#8217;s no identifier that lets me select them all in a Report.</p>
<p>So, here&#8217;s a trick&#8230; After using DataLoader, two files are created. A <strong>success file </strong>contains a copy of all records that were successfully loaded, <strong>with a new ID column inserted</strong>. I can use this file with the Import command to update all the statuses. This takes care of all the Contacts that were created during the original Insert of Contacts. Fantastic!</p>
<p>But what about the Contacts that already existed, and therefore caused an error during the Insert? Well, the ID is actually supplied in the error message (eg <code>duplicate value found: EmailAddr__c duplicates value on record with id: 0032000000Fs7Xp</code>) and can be extracted using a RIGHT(B2,15) type of spreadsheet command. Just put that value in a new column, import the file and you&#8217;re done!</p>
<p>(To slightly simplify things, it&#8217;s also possible to load just one file — the original CSV file! Since all records now exist, every row will generate an error. You can then just process the <code>error</code> file rather than separately loading the <code>success</code> and <code>error</code> files.)</p>
<p><img class="aligncenter size-full wp-image-52" title="Mass Update Anything" src="http://theenforcer.net/wp-content/uploads/2008/08/massupdate.png" alt="" width="364" height="254" /><br />
I&#8217;ll admit that during this process I stuffed up — I imported attendees to the wrong campaign. To remove them, I could have deleted the Campaign and started again. Instead, I used a favourite utility called <a href="http://www.salesforce.com/appexchange/detail_overview.jsp?id=a033000000331IjAAI">Mass Delete Anything</a> (there&#8217;s a Windows and a Mac version). I just created an appropriate SOQL command to identify the offending records, then Mass Deleted them. Very handy, but also very dangerous. Use with care on your Production systems.</p>
<p>The end result of all this&#8230; My Campaigns can now report counts of Total Contacts for the Trade Shows. When combined with a Trigger I&#8217;ve got that identifies people when they purchase products, I can track the conversion rate for Trade Show attendees, all without having to manually type any Contact information.</p>
<h3>The Bottom Line</h3>
<ul class="nomargin">
<li>You can&#8217;t import Contacts directly into Campaigns, but you can import a list of existing Contacts to <em>link</em> to a Campaign</li>
<li>DataLoader saves the day again, especially with the information saved in its <code>success</code> and <code>error</code> output files</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://theEnforcer.net/2008/08/loading-contacts-into-campaigns/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

