[SalesForce] How to replicate the “Add to Campaign” button

My idea is to have the "Add to Campaign" button at the top of the Contact page, rather than on the related list, at the bottom of the page.

I´ve created the button by navigating to "Contacts" – "Buttons, Links and Actions" – "New Button or Link", and then using the campaign lookup page´s url as the button´s url. However, when clicked upon, the button doesn´t take me any further than that lookup page. I can see my campaigns, but clicking upon them does nothing. I´ve also tried referencing the Contact ID field within the url: this results in no campaigns being shown on the lookup page at all.

Any ideas as to what I´m doing wrong?

Edit:

https://eu7.salesforce.com//003?rlid=CampaignMembers&id={!Contact.Id}

^Latest attempt, which results in this error message:

The value of the "rlid" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

Best Answer

I don't know if this is exactly what you're looking for, but I actually just borrowed the code from the existing button (warning: may not be future-proof). Here's the button I created:

Label       Add to Campaign     Object Name     Contact
Name        Add_to_Campaign      
Namespace Prefix                Display Type    Detail Page Button
Behavior    Execute JavaScript       
OnClick JavaScript  openLookup('/_ui/common/data/LookupPage?lkpr={!Contact.Id}&lktp=701&enableScopes=1&addToCampaign=1',670,'1','')

This opens a new window for the user to select a campaign, and on selection, they're prompted to set a new status and any other custom attributes for the campaign.

Related Topic