Skip to main content
SFDC Developers
Lightning

URL Hacking in Salesforce Lightning

Vinay Vernekar · · 1 min read

Wow! URL Trick is now supporting in Salesforce Lightning edition as a part of Spring 20 Salesforce Release.

Not sure how many of you tried the URL trick back in classic edition to pre populate field values in edit/new record form of record. When lightning was released, this was one of the feature we were missing a lot. Just to build this functionality, we needed to write custom lightning component with the help of lightning data service.

This much work is no more needed now. Populating field values on new record form is now being supported by passing the values through URL. But populating field values on edit form is not yet supported, hopefully it will be available in next releases.

You need to construct URL as follows.

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

In this example, I am constructing URL to redirect to account creation page where Name field is auto populated with lead's company, Type as Prospect and Custom field checkbox to checked. The final URL in browser looks like below:

/lightning/o/Account/new?defaultFieldValues=Name=SFDCDevelopers,Type=Prospect,Custom_Field__c=true

Add as many as fields and assign values to them, make sure they are separated by comma (',').

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

Share this article

Vinay Vernekar

Vinay Vernekar

Salesforce Developer & Founder

Vinay is a seasoned Salesforce developer with over a decade of experience building enterprise solutions on the Salesforce platform. He founded SFDCDevelopers.com to share practical tutorials, best practices, and career guidance with the global Salesforce community.

Comments

Loading comments...

Leave a Comment

Trending Now