Pre-populating fields at record creation in Lightning Experience

With Lightning Experience, we can’t use url hacks anymore. I’m fine with that, as this was not a supported solution.
However, behind this technical hack was a business need: pre-populate field on record creation, often with different values depending on where you’re coming from.

I tried to play with sforce.one to pass some parameters and as I expected I was not able to pass any parameter.

My question is: Is there a way to pre-populate fields on record creation (or have you heard of it on the roadmap), or should we just forget about this business need for now with Lightning Experience ?

Obviously, as we’re starting to do impacts analysis on existing orgs for clients wishing to switch to Lightning Experience, this would be a big step back.

Answer

The Spring ’20 release brought the URL hack for prepopulating field values to Lightning. You can now achieve this with custom buttons and links (not Javascript buttons) much like we used to in Classic.

Spring ’20 release note: Navigate to a Record’s Create Page with Default Field Values

Where: This change applies to Lightning Experience in all editions. This change doesn’t apply to Lightning Out, Lightning communities, or the Salesforce mobile app.

How: To construct a custom button or link that launches a new record with prepopulated field values, use this sample formula:

/lightning/o/Account/new?defaultFieldValues=
    Name={!URLENCODE(Account.Name)},
    OwnerId={!Account.OwnerId},
    AccountNumber={!Account.AccountNumber},
    NumberOfEmployees=35000,
    CustomCheckbox__c={!IF(Account.SomeCheckbox__c, true, false)}

Attribution
Source : Link , Question Author : Fabien Taillon , Answer Author : Bow-chicawow-ers

Leave a Comment