Fixing the ‘fix’ - the return of the ‘add to campaign’ button

The Spring 16 release contains a ‘fix’ for a problem that IMHO does not exist.

update: the link to help and training above now pulls up a blank article. google’s cache shows the article describing the ‘fix’. Perhaps a change is in the air.

Prior to spring16, read access to a contact was sufficient for a user to add the contact to a campaign. So you could have a public read-only or private contact sharing model, while allowing users to add any contacts they could see to campaigns.

Apparently that was a problem. So, the ‘fix’ was to automatically hide the add to campaign button unless the user has edit on the record. However, as this is not enforced on list views or reports, if that is a serious security issue, then its not really fixed. Regardless, this quickly started to cause me problems. It started with increasing support requests from users, and soon I was resorting to adding custom fields and flows or giving users edit access on all contacts as a temporary fix. As there has been no indication of any resolution on my open case from the salesforce end and as the problems continued to add up, I finally decided to try and find / hack up a solution.

I tried various hacks, and finally, it was so simple. Just clicked ‘inspect’ on the standard add to campaign button, and copied the javascript to a new button on the campaign object, and it works!

Screenshot 2016-03-30 at 6.42.04 PM.png

So, to pull this off, create a new button on Campaign
Display type: list button
Behavior: execute javascript
Content Source: onClick javascript

and use the code below for the button content (for contacts - you will need to create a separate button for leads)


Add the button to the campaign member related list on contact, and voila - your add to campaign button is back.

But now it doesnt disappear.

Note - this wont work in lightning as onclick javascript buttons are not supported. Sorry, hopefully there is an official fix for the fix soon. Really this behavior should be set in campaign OWDs - idea coming..someday.

*For leads, create a button on campaign as above and change {!Contact.Id} to {!Lead.Id} for leads, as indicated below:


Now read this

Creating a unique collection in flow

this is a very short post, that shows one small thing that can be very useful - creating a collection of unique elements in visual workflow there are now quite a few operators on collections in flow, but none of them are ‘remove... Continue →