Replacing URL hacks With Pre-Defined Actions in Lightning Experience

lightning Readiness check tells you that  if you have any buttons based on URL hacks will not be supported in Lightning Experience. For example, If you are using any button of type URL to pre-populate some values from Parent record, They might not work in Lightning.

Let’s say, On Account record page, You are having URL button to pre-populate some field values using URL hacks. They will not work in Lightning. 

You might be looking for the option that will be supported in Lightning Experience.  The quick action will come to rescue you in such situations.

The quick actions are of different type but we will mainly discuss about the object specific quick actions as URL hacks are also object specific.

  • Object-specific actions can update records.
  • Object-specific actions can create records that are automatically associated with related information. For example, a user could initiate an action that simultaneously creates a contact and associates it with an account.

Steps to create Object-specific action

  1. On object manager page of an object, Go to Buttons, Links, and Actions and click New Action.
  2. Verify that the action type is Create a Record. (Note: Actions can do more than just create records.)
  3. In the Target Object dropdown list, select the object name to create record with pre-populated values.
  4. Enter your desired name in the Label field.
  5. Click Save .
  6. In the layout editor, Add your minimal required fields to create a record undefined
  7. Click Save

Here, we have created one action on Account to create a record of Object Opportunity associated with account with auto population of Account description on Opportunity description. In order to pre-populate, We need to set pre-defined values to account and description fields dynamically.

Steps to Set Predefined Field Values for Quick Action Fields

  1. Click the name of an action in the Buttons, Links, and Actions list or the Global Actions list.
  2. On the action detail page, click New in the Predefined Field Values list. undefined
  3. Select the field you want to predefine a value for. undefined
  4. Specify the value for the field.For single-select picklists, you can specify both a specific value and a formula value. If you set both, the formula value takes precedence over the specific value. undefined
  5. Click Save.

Here, We have set the pre-defined value for description field of Opportunity by referencing the account description fields. I have added screenshots for description, but you need to set the pre-defined value for Account Name field of Opportunity to associate it with an Account.

Its time to add the action on the related list of Account. Go to Object Manager of Account object and select Page layout and edit the page the layout assigned to you. Add the newly created action to Salesforce Mobile and Lightning Experience Actions section and save your layout.

Everything is set now. You can check your Action now. Navigate to an account record and you will see your button on the Highlight panel.

When you click on that button, A Popup will appear with description and Account field of Opportunity auto-populated from the current Account record as below.

This way, you get an alternative to eliminate your URL hacks used in Classic.


Leave a Reply