In Blog, Tips & Tricks

The URL hack has been a special “secret” for admins for years. It’s great for creating a custom button or link to help our users fill out data. I’ve used the URL hack for three primary purposes:

  1. Create a related record and pre-fill fields.
  2. Link to a report with dynamic filters.
  3. Pre-select email template and recipients (custom “Send an Email”).

With Chatter Publisher Actions, we no longer need a URL hack for creating new records. A custom action might be able to handle the other two use cases, but I’ll save that for the developers. There are fantastic reasons to use a Chatter Publisher Action instead of a URL hack:

  • It’s easier to create
  • It’s available in mobile (Salesforce1)
  • Officially supported by (URL hacks are not)
  • Can be deployed – even when using new custom fields

***Updated 1/9/2014 — I was reminded that I forgot a really good reason to use a Publisher Action instead of a URL Hack:


First, let’s review what it takes to do a URL hack.

  • Identify the fields you want to populate
  • Identify the HTML names for each field
  • Create a custom button/link by modify/adding parameters
  • Build the URL

I’m not going to go into details of how to build a custom button URL hack. Let me know in the comments if you want a “How to” on URL hacks. Otherwise, here’s some other posts:

Creating the actual URL can be fairly easy and simple, especially if you’re just dealing with a couple of fields. More than a couple of fields the URL can get long and messy. Plus there’s no guarantee that a custom field ID will be the same on production unless you refreshed after it was deployed. That makes URL hacking messy. Enter – the Chatter Publisher Action!

Here’s the scenario.

I have a custom object related to Accounts and Opportunities called “Sales Strategies.”  The record will always be created from the Opportunity. I want a user to be able to click and enter a new Sales Strategy that’s already tied to the Account and Opportunity.

Before we begin, make sure you have Publisher Actions enabled. The setting can be found under your Chatter Settings.

Let’s create a Chatter Publisher Action:

  1. Go to the “Buttons, Links, and Actions” Menu option under Opportunities.
  2. Click “New Action” & fill out details.
    New Chatter Action

    New Chatter Action

  3. Add fields to be on the Action Layout.
    Adding fields to Action layout

    Adding fields to Action layout

  4. Set Pre-defined Values. Here’s where we can set the Account name by grabbing the Account from the Opportunity.
    Adding a Predefined Field

    Adding a Predefined Field

  5. Add to the Opportunity page layout.

And we’re done! Here’s what it looks like on the page:

Publisher Action in use

And the result when we hit create:

Created Record from publisher action

Chatter Publisher Actions are fantastic. They are very easy to update. You don’t need to grab IDs. You don’t need to worry about missing a character or spaces in the URL. Plus you can use the standard Salesforce formula builder. Want to have the name be defaulted to a combination of the Account Name and Close Date? No problem! Just set a new pre-defined field.

Predefined Field for strategy Name

Predefined Field for strategy Name

Our Sales Strategy Name is magically defaulted:

Action with Default Strategy Sales Name

The URL Hack still has great use cases. My favorite use case is pre-selecting an email template and recipients for “send an email.” Let me know if you’re interested in the comments and maybe that’ll be a future post. I’ll love to hear what you’ve used Chatter Publisher Actions for. Post in your Chatter Actions in the comments!

I’ll leave you with some screenshots of what our publisher action looks like in Salesforce1. I didn’t have to do anything extra to get this to be available. It’s simply there. You can test out your own publisher actions in Salesforce1 using a compatible browser (like Chrome) and going to /one/ — for example:

Sales Strategy Chatter Action available in Salesforce1

Sales Strategy Chatter Action available in Salesforce1

Using our new Sales Strategy action in Salesforce1

Using our new Sales Strategy action in Salesforce1

Recommended Posts
Showing 13 comments
  • SutoCom
  • Thomas Taylor (@tet3)

    Kudos on writing a blog post that I’ve been procrastinating on writing for a while. One other use case/method for URL Hacks is as formula fields that can be included in list views, reports and related lists per-record. For instance, I was just talking with someone about a “Create Opportunity” link formula on Campaign Member that would name the Opp, associate it with the CM’s Contact.Account and maybe populate a couple other fields. And can automatically open a new Window/Tab. Use case is working a list of campaign members for a short sales-cycle campaign – publication ad sales, donations, event ticket purchase.

    • Salesforce Wizard

      I can totally see that. The URL Hack still has it’s placed. A custom Publisher Action might be able to do the same thing, but a URL Hack is currently much easier for most Admins to handle

      • Kevin

        A custom Publisher Action cannot preselect a template and include a CC: address – silly but very true

  • L01$Lan3

    can you create an action for internal case comments?

  • Bailey Rudd

    I see this is an older post, but you mentioned if there was interest in posting about pre-selecting an email template and recipients for ‘Send an Email’ (URL hack) to write it in the comments. Which I’m doing! Thank you in advance,

  • Deena


    We are still using salesforce classic and we have a Location VF page that when the new Job button on a related list is created that some of the fields have pre-populated values from the Location page. I’m trying not to use URL hacks and tried the Quick action workaround. But now my problem is how to add the quick action to the VF page. Any help?

    • Brian Kwong

      Depending on what you want to do, you can either expose Chatter on the page to give them access to the chatter/quick actions.

      Another alternative is you can call a quick action in apex and then call that apex method via a button the page layout.

  • Julien C

    Hello Brian,

    Thanks for your awesome tips.
    I do use the URL hack for another thing : In an external application, a button was placed to open a new Salesforce case, with pre-populated fields, such as Account name and contact name.
    This way, it was easier for the users to finish to fill the case before saving it, with some fields already done.

    Now, we are moving to Lightning, but unfortunately this solution doesn’t seems to be possible anymore.
    I don’t see yet how to open a half filled case with external data on it through a button.

    Best regards,

    • Brian Kwong

      Hey Julien,

      You’re welcome. I’m glad you find it helpful.

      You should check out the newer blog posts on this subject like this one:

      At the start of the year, Salesforce added a version of URL hacks for creating new records. It only works with new records and it basically hacks their own lightning component.

      Since you’re coming from outside the application, have you considered Web to Case instead?

pingbacks / trackbacks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.