Great URL Hack, Meet The Chatter Publisher Action

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 Salesforce.com (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/one.app — for example: https://NA9.salesforce.com/one/one.app

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

Showing 11 comments
  • SutoCom
    Reply
  • Thomas Taylor (@tet3)
    Reply

    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
      Reply

      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
        Reply

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

  • L01$Lan3
    Reply

    can you create an action for internal case comments?

  • Bailey Rudd
    Reply

    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
    Reply

    Hi,

    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
      Reply

      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.

pingbacks / trackbacks

Leave a Reply