Skip to main content

How I solved the "lookupcmpgn avoiding mass email campaigns" problem

 

If you use a mass emailer like Vertical Response for a monthly newsletter, you might have noticed that when you create new donations from a Contact by pressing the New Contact Donation button (or by using the "lookupcmpgn" argument on your custom button), that the Primary Campaign Source field of the resulting donation is often set to a mass email campaign, not to the most recent "real" campaign that your Contact is a member of.  That's because every month you are adding most or all of your Contacts to the email newsletter campaign, so it "overshadows" the most recent "non-mass-email" campaign they have been added to previously.  So when a donation comes in due to that most recent "real" campaign, you have to change Primary Campaign Source from the mass email campaign back to the "real" campaign that caused the donation to happen.  Sort of takes away the benefit of having SF auto-fill that field.

 

Using a field, few processes, and a custom button argument, I figured out how to get Primary Campaign Source filled in correctly.

 

* First, create a field on Contact of type lookup to Campaign called "Last nonEmail Campaign"

* Then create a process on CampaignMember create that fills that field over on Contact with the CampaignID field value (via CampaignMember-->ContactID) *only when Campaign.Type <> Email* (or whatever field and field value you use to denote when a Campaign is your mass email newsletter campaign).  This step "remembers" the most recent "real" Campaign that a Contact gets added to.

* Create a process on Opportunity that fills Primary Campaign Source with the value from "Last nonEmail Campaign" (via Opportunity-->PrimaryContact) only when PrimaryContact is not null and when PrimaryContact-->LastnonEmailCampaign is not null.  This step relies on the process running after NPSP has filled in the PrimaryContact field, which seems to work.

 

This much does the job - however, after you click that New Contact Donation" button and arrive at the donation record in edit mode, you still see the "email newsletter" value in Primary Campaign Source because all of the above processing doesn't happen until after the record is saved.  To fix this, you need to:

 

* Remove the "lookupcmpgn" argument from the custom button URL

* Add an argument: opp17={!Contact.Last_nonEmail_Campaign__c}

.  This puts the text of most recent "real" Campaign in the Primary Campaign Source field, but as far as I have been able to tell, you still need the processes to get the real ID also.

@Salesforce.org System Administrators

0/9000