Making a WTF Salesforce button for your users

Anna Hazel Crotty
Aug 9, 2017 · 2 min read

One problem I have consistently with Salesforce users is getting them to tell me about things that are frustrating and/or difficult for them. Typically they run into something annoying and intend to tell me, but they’re in a hurry and by the time they think to tell me they can’t remember exactly what it was. I decided a while back that I needed to create a WTF Salesforce button that would show up in as many places as possible, and would let them really quickly tell me the problem (or even just that they got frustrated) and then get back to what they were doing.

In a perfect world this would be some floating button that would appear literally everywhere. But I don’t want to write a bunch of complicated code for this, and I don’t have a lot of time to spend on it. Fortunately you can do this with custom buttons.

Yes, this assumes you’re using classic. I like Lightning, but there are still some basic things that need to happen in there before we can switch over completely.

First off, figure out the objects your users look at the most. In my case it is accounts, contacts, opportunities, recurring donations (NPSP) and campaigns.

For each of those objects, you need a custom button. The behavior is Execute JavaScript, and the OnClick JavaScript details are:

location.replace(‘/email/author/emailauthor.jsp?retURL={!OBJECT.Id}&p3_lkid={!OBJECT.Id}&p2_lkid=SYSADMINCONTACTID&template_id=EMAILTEMPLATEID&p6={!User.FirstName} used the WTF Salesforce Button&p23={!$User.FirstName} encountered a problem at https://naXX.salesforce.com/{!OBJECT.Id}&p5');

You need to replace the all caps stuff.

OBJECT: The object you’re using, say, Account

SYSADMINCONTACTID: The contact or lead record with the email of the administrator who should receive this email.

EMAILTEMPLATEID: Your email template id.

XX: this needs to match your Salesforce url, i.e., na41.salesforce.com

Once you’ve created the button(s), you’ll have to add them to the appropriate page layouts. Users can then vent by clicking WTF Salesforce, adding text if they want, and clicking send. They’ll be taken right back to where they were.

Many thanks to the always awesome Salesforce Ben, whose post on email url hacking was extremely helpful on this.

Anna Hazel Crotty

Written by

Technology, InfoSec, Salesforce, Nonprofits