GetFeedback

Creating Custom Buttons in Salesforce

Essentials feature: Available on Essentials, Pro, and Ultimate plans.

Create a custom button in Salesforce to send a survey email from a record, such as Account or Case. For example, you can create a button called Send Customer Feedback Survey on the Case record that sends an email with a survey link to the contact.

Create an email template in your connected Salesforce instance that includes your survey link. You’ll use this email template in your custom button.

Note the Template ID from your template. You can find the Template ID in the URL when editing your template. It may look similar to this: 00XG0000001rrOL

GetFeedback Support can’t consult on coding issues. Reach out to your Salesforce administrator for help implementing these features. These examples help you get started with our Salesforce integration and you may need to make changes for your organization.

To create your custom button:

  1. In Salesforce, go to Setup.
  2. Go to the object (ex. Case), then select Buttons, Links, and Actions.
  3. Select New Button or Link.
  4. Enter a Label, Name, and Description for the button.
  5. For Display Type, select Detail Page Button.
  6. For Behavior, select Execute Javascript.
  7. For Content Source, select OnClick Javascript.
  8. Enter the Javascript to use for the button. We’ve provided a sample snippet below.
    • Next to template_id=, replace the number with your template ID.
    • For p5=, replace the email address with any email addresses you want to BCC.
    • For p24=, replace the email address with any email addresses to send the email to.
    • For p26=, replace the email address with the From address to use in your email.
  9. To check for errors in your Javascript, select Check Syntax.
  10. Save your button.
Image of custom buttons code

Learn more about the Javascript syntax and how to customize it to fit your needs.

SyntaxExplanation
/email/author/emailauthor.jspTells Salesforce to send an email when the button is clicked.
template_id=The email template to send.
p2_lkid=The contact to send the email to.
p3_lkid=Any other merge data in the email template from a related object. For example, the ID of an object (e.g. Account, Case, Opportunity) that the email is related to. Fields from this object can be merged into the email template.
p3=The related object to include.
p4=The comma separated list of emails to include in CC.
p5=Email addresses to BCC.
p24=Other email addresses to send the email to.
p26=The sender address to use in your email.
retURL=The page to go back to after clicking the button and sending the email.