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:
- Create a related record and pre-fill fields.
- Link to a report with dynamic filters.
- 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:
.@Kwongerific URL hacks make @shannonsans cry 😉
— Shannon Hale (@shannonsans) January 9, 2014
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:
- http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html by Ray Dehler
- http://writeforce.blogspot.com/2013/01/prepopulating-fields-using-url-hacking.html by Saurabh Dhoble
- http://amberneill.wordpress.com/2012/02/20/taking-ownership-leads-cases/ by Amber Neill
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:
- Go to the “Buttons, Links, and Actions” Menu option under Opportunities.
- Click “New Action” & fill out details.
- Add fields to be on the Action Layout.
- Set Pre-defined Values. Here’s where we can set the Account name by grabbing the Account from the Opportunity.
- Add to the Opportunity page layout.
And we’re done! Here’s what it looks like on the page:
And the result when we hit create:
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.
Our Sales Strategy Name is magically defaulted:
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
-
[…] Great URL Hack, Meet The Chatter Publisher Action […]
Leave a Reply
Reblogged this on Sutoprise Avenue, A SutoCom Source.
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.
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
A custom Publisher Action cannot preselect a template and include a CC: address – silly but very true
can you create an action for internal case comments?
I don’t think you can with the normal internal case comments. You MIGHT be able to do so if you’re using Case Feed if I’m understanding this help document right: https://help.salesforce.com/apex/HTViewHelpDoc?id=case_interaction_related_lists.htm
looks like case feed changes internal comments and replaces it with a type of Chatter post.
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,
something like this? http://wp.me/p5Tbvq-4n
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?
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.
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,
Julien
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: https://thewizardnews.com/2020/01/27/url-hacks-are-back-and-in-lightning-with-spring-20/
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?