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

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)}

You may also like

8 comments

Gary Thorn February 26, 2020 - 3:34 am

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

Reply
Sakthivel Madesh March 27, 2020 - 10:06 am

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}

Reply
Kuldeep February 27, 2020 - 10:13 am

I don’t think this new feature works well with Record types.

Reply
Sakthivel Madesh March 27, 2020 - 10:07 am

we need to pass likely,
RecordTypeId=

Reply
Ranjana February 27, 2020 - 12:07 pm

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?

Reply
Rashida Burhani March 26, 2020 - 5:25 am

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

Reply
Sakthivel Madesh March 27, 2020 - 10:05 am

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

Reply
Mahendra April 6, 2020 - 4:21 pm

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}

Reply

Leave a Comment