URL Hacking is back in Salesforce Lightning Experience – Spring 20 Release

As part of Spring 20 Salesforce Release, URL Hacking is back in Salesforce Lightning Experience.

Now you can create custom buttons (Similar Salesforce Classic URL hacking version) and links that pass default field values (defaultFieldValues) while creating a new record.

You can define default values while launches from custom button or custom link or custom code to create new record with prepopulated field values below are the simple formula:

/lightning/o/Account/new?defaultFieldValues=
Name={!URLENCODE(Lead.Company)},
Type=Prospect,
OwnerId={!Lead.OwnerId},
Website={!Lead.Website}

Use Case:
Create a New Account from Lead Detail page with populate Lead values and some of the prepopulated filled values in New Account Creation form
Step1: Created New Custom Button in Lead Object  (Setup -> Object Manager -> Lead -> Create Buttons)

Step2: Enabled the New Button in Lead Page Layout (Lead -> Page Layouts)

Step3: click the New Button from Lead Detail Page

Step4: Populated the Lead values like Lead Company, Lead OwnerId, Lead Website and Type value as Prospect in to New Account Screens.

 

Note:
– The URLENCODE function works only when creating custom buttons and links. You can’t use it for custom fields.
– URL Hack working only in New Record and not in the Edit forms
For example:-

https://sakthi-techforceservices-dev-ed.lightning.force.com/lightning/o/Account/new?defaultFieldValues=Name=Sakthivel%20Madesh   -> Its Work

https://sakthi-techforceservices-dev-ed.lightning.force.com/lightning/r/Lead/00Q2v00001UbNsqEAF/edit?defaultFieldValues=Description=Test   -> Its Not Work

Reference: https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_general_lex_navigate_to_record_dfv.htm

Some Other Examples like passing hard code values and passing custom fields

/lightning/o/Account/new?defaultFieldValues=
Name={!URLENCODE(Lead.Company)},
Type=Prospect,
Website={!Lead.Website},
NumberOfEmployees=35000,
CustomCheckbox__c={!IF(Lead.SomeCheckbox__c, true, false)}

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

8 thoughts on “URL Hacking is back in Salesforce Lightning Experience – Spring 20 Release

  1. Sakthivel Madesh: I have read your article over and over. I can not get this to work in Lightning. I am trying the following:
    /lightning/o/Quote/new?defaultFieldValues=
    Name={!URLENCODE(Opportunity.Name)},
    OwnerId={!Opportunity.OwnerId},
    Projected_Study_Start_Date__c = {!Opportunity.CloseDate},
    Proposal_Writer__c = {!Opportunity.Proposal_Writer__c},
    Client_Protocol_Number__c = {!Opportunity.Client_Protocol_Number__c}

    I am placing this on the Opportunity Related list for Quotes. I need to have users create a new quote from the opportunity. I have this working using the old method in Classic. But I can not get this to work. Any ideas what I am doing wrong?
    Gary

    1. Remove the space between variable and value.

      /lightning/o/Quote/new?defaultFieldValues=
      Name={!URLENCODE(Opportunity.Name)},
      OwnerId={!Opportunity.OwnerId},
      Projected_Study_Start_Date__c={!Opportunity.CloseDate},
      Proposal_Writer__c={!Opportunity.Proposal_Writer__c},
      Client_Protocol_Number__c={!Opportunity.Client_Protocol_Number__c}

  2. Hello,

    I was exploring the URL hack in lightning, but was unable to copy custom picklist which is a dependent picklist. Is there anything else do i need to do specifically for picklist?

  3. Hi Sakthi,

    I am a Salesforce Admin, and have created this custom URL hack button in Classic in the past (for a different org, in a different job), but am struggling with creating it in my current Lightning environment.
    Scenario: Create a “New Credential” button from the “Project” object. The Project and Opportunity names should be prepopulated on the New Credential record page.
    Here’s what i have:
    /lightning/o/Credentials__c/new?defaultFieldValues=
    Credential ID = {!Credentials__c.Name},
    {!Credentials__c.Opportunity__c} = {!pse__Proj__c.pse__Opportunity__c},
    {!Credentials__c.Project__c}= {!pse__Proj__c.Name},
    {!Credentials__c.RecordTypeId}=0125O000000VAcgQAG

    The New Credential page pops up, but the Opportunity and Project values are blank.

    Appreciate any help.
    Thanks,
    Rashida

    1. Use Like
      /lightning/o/Credentials__c/new?defaultFieldValues=
      Name={!Credentials__c.Name},
      Opportunity__c={!pse__Proj__c.pse__Opportunity__c},
      Project__c={!pse__Proj__c.Name},
      Credentials__c.RecordTypeId=0125O000000VAcgQAG

  4. ReordType can be set as follows:

    /lightning/o/Account/new?&recordTypeId=0125O000000VAcgQAG&defaultFieldValues=
    Name={!URLENCODE(Lead.Company)},
    Type=Prospect,
    OwnerId={!Lead.OwnerId},
    Website={!Lead.Website}

Leave a Reply to Kuldeep Cancel reply

Your email address will not be published. Required fields are marked *

*