Salesforce Lightning URL Hacking

Here I have created a custom detail button(New Contact) on Account object with some pre-populated Contact field values from Account record using Lightning URL Hacking.

Go to setup | Object Manager | Account | Buttons, Links, and Actions | Create a new Button

  • Label – New Contact
  • Display Type – Detail Page Button
  • Behavior – Display in new window
  • Content Source – URL

URL Content:

/lightning/o/Contact/new?defaultFieldValues= OwnerId={!Account.OwnerId},AccountId={!Account.Id},MailingStreet={!Account.ShippingStreet},MailingCity={!Account.ShippingCity},MailingState={!Account.ShippingState},MailingPostalCode={!Account.ShippingPostalCode},MailingCountry={!Account.ShippingCountry}

Add this button to Account detail page layout, “Mobile & Lightning Action” section.

Note: This URL Hacking with button doesn’t work in Salesforce1 mobile app.