Migrate Your Salesforce URL Hacks to Actions

URL Hacking has remained infamous in the Salesforce space for a while. If you are unfamiliar with the term, it essentially means that you can create a custom button in Salesforce classic that will create a new record, but pre-populated with information from the original record. For example, you could replace the “New” Opportunity button on the account related list page, with a URL hack that pre-populates the new Opportunity with a bunch of account data.

The reason it’s infamous? URL Hacking is a completely unsupported feature, so technically it’s a bit dodgy to use. However, people have used this workaround for many years with no problems. One potential issue URL hacks will face is when an organization decides to switch to the Lightning Experience. Classically custom buttons and URL hacks are not supported in the same way they are in lightning, which means you will run into issues. Introducing Actions…

Actions

Actions can be used in various different ways across classic & lightning to efficiently interact with records. There are various types of actions including standard, default, mobile, and customer, for a full overview check out this handy article. For this guide, we are going to be concentrating on custom actions as these enable us to have some fun. There are two types of custom actions.

Global Quick Actions – Global actions allow you to create actions that can sit anywhere. Actions such as creating a record, logging a call and sending emails are available. The key difference here is that these actions can sit on any object in your Org.

Object-Specific Quick Actions – Object-specific actions allow you to carry out very similar functions to global, but they also allow you to update records. The key difference here is that they are created on an object by object basis and can only be used for the object they are created for. This is because the action MAY contain formulas or references that only work with its specific object. These are the actions we are interested in to replace URL hacks, as we want to reference object specific fields.

You can expect to see the actions within the chatter section in classic, or in your highlights panel in lightning…

Lightning

Classic

Creating Object-Specific Actions

Object-specific actions are super easy to create with a standard point and click interface, you can build quick actions in minutes. This is a great step in the right direction, as powerful as URL hacks were, they were fiddly and awkward to create for novice Admins. For this short tutorial, I’m going to be using the same use case as I did on the original URL Hacking tutorial. This is to create a custom object record called “Resource Request” off of an Opportunity, with pre-populated information.

Step 1 – Which Object?

Firstly, we need to decide where this action is going to sit. Actions are placed on the page where you want to create them from, in exactly the same fashion as custom buttons in URL Hacks. For this resource request example, we are going to want to place it on the Opportunity. To access actions, navigate to Setup > Opportunity > Buttons, Links, and Actions > New Action

Step 2 – Create the Action

After clicking on “New Action” you will be greeted with the setup page for creating a new action. From this page, you can create various action types such as creating a record, updating a record, sending an email, among others. To replace a URL hack we want to focus on creating a new record.

From the image on the right, you can see the basic settings needed in order to create the basis of the action. We simply need to define the Type, Target Object, and a label. Step 2 complete!

Step 3 – Action Layout

Once completed and saved, the next step is the create the action layout. You can think of the action layout as a miniature layout that contains the important and required fields needed to create the record. This has major advantages over the older URL hacks, as once clicked, you were taken to the full edit page of a record.

Below you can see a simple mini layout I’ve created which has the core fields I want to show.

Step 4 – Predefined Field Values

Now we have completed the action layout, we can really have some fun. So far we have created a usable action that can be placed on our record page to launch a pop-up box with the fields defined in the layout. However, this doesn’t replace our URL hacks just yet as the main advantage to using them, is pre-defined field values. You can get started by clicking new on the Predefined Field Values section at the bottom of the action layout.

By clicking new, you are able to set the field values in your new record using the standard Salesforce formula editor. This is massively more powerful than URL hacks as you can quickly access fields across all relationships (reducing development time), but also run calculations. For example, you can see below that I have prepopulated the “Project Hours” field on my RR object, from the “Estimated Project Hours” on my Opportunity.

Below you can see an example of a few fields I have added to be prepopulated. Including making the start date equal to the close date + 10.

What this results in upon clicking the action, is a beautifully pre-populated popup box ready to create your new record!

Step 5 – Add to the Layout

The fifth and final step for your new action is to add it to the layout. There is one small quirk here that I would like to address just to prevent any confusion. The section where you add your action to the layout will depend on whether you are using Classic or Lightning.

If you head over to the page layout of your chosen object, you will notice that there is a section for “Quick Actions” as well as “Lightning Actions”. The key difference here is Lightning Vs Classic…

Lightning – These are placed as per the screenshot above which display in the highlights panel in Lightning. You can access these via the “Mobile & Lightning Actions”.

Classic – These are placed in the Salesforce Classic Publisher in the chatter feed section of your layout. You can access these via the “Quick Actions”.

Salesforce will automatically create duplicates of your actions ready to either be slotted into Classic or Lightning. Just ensure that you add them to the correct section on your page layout.

Conclusion

I hope you have enjoyed this article on how to migrate your URL hacks over to quick actions. I’m sure you will agree that with the easy point and click interface, as well as the extra functionality, this is a migration worth doing for yours and your users benefit! It’s also great to get ahead of the game if you are yet to switch over to Lightning.

If you have any questions, let me know in the comments below!

Subscribe To The Monthly Newsletter

No Spam. No Rubbish. Just great content from the Salesforce Industry.

You have Successfully Subscribed!

11 thoughts on “Migrate Your Salesforce URL Hacks to Actions

  1. This is very useful one..:) however how to migrate Related List buttons? For example if I want to create an Opportunity from Account with default values with default Page layout, what is the recommendation?

  2. I’ve always used URL hacks to create reports with custom filters. I haven’t played with these quick actions enough to know if that is possible, so would this method replace the need for the URL hack there?

  3. I’m using Classic/Enterprise Edition. My Action Type options were only: Custom VisualForce, Update a Record, Lightning Component, Flow (Beta). What do I do to see the options you show in your post? Create a Record and Send an Email are what I’m most interested in.

  4. I have created my quick action. I am using Classic, but can’t see how to add to the page layout. I don’t seem to have a Chatter Feed section. I am using the Contact Object.

    I got lost on this bit:
    ‘Classic – These are placed in the Salesforce Classic Publisher in the chatter feed section of your layout. You can access
    these via the “Quick Actions”.’

    I am not sure what to do here? Can you please give a bit more detail on this bit? I can see how useful this will be for me.

  5. Hi Ben, this is very helpful, thank you. We were big ‘URL Hackers’!
    I am looking to copy a Contract, clear some fields and define values for others.
    I defined the Relationship on the action as the ‘Related Contract’, so how do I create predefined field values using values from the related Contract? ie: the original Contract? Is that possible?
    Thanks!

  6. I think an important limitation to point out with respect to using Actions in place of URL Hacking:

    When you predefine the value for a Picklist field, you can only select a specific value to predefine. You can’t dynamically define it with a formula like you can with a URL hack 🙁

  7. I created a quick action off the opportunity to create a case but my case assignment rules aren’t working for the quick action. Is that common?

  8. I have a question similar to what Milla asked about using url hacks to create reports with custom filters. After reading the link posted by Jeff Kranz (https://help.salesforce.com/articleView?id=reports_filter_url.htm&type=5
    ), I understand that I can add a particular value to a report filter, but what I want to do is pass the value from a field on a custom object and populate the report filter. I have a bunch of buttons that do that now, but they won’t work in Lightning.
    Right now, I have simple buttons that look like this: /00O000000089gps?pv0={!Client_Master__c.Name} That passes the customer name into the first filter on my report. It works perfectly. How can I do this in Lightning from the object level?

Add Comment