Thursday, 28 January 2021

URL Hacking in Lighting Experience

 Hi,

Here we are going to learn how to do URL hacking in Lightning Experience.

1)When we have to navigate to the child new record page with default values from the parent Detail page then we have to follow the below step:

  • Create a detail button URL type with the following url
  • /lightning/o/<child_Object_APIName>/new?defaultFieldValues=<FieldAPIName1>=<value>,<FieldAPIName2>=<Value>
  • Eg:
  • /lightning/o/Contact/new?defaultFieldValues=LastName={!URLENCODE(Account.Name)},AccountId={!Account.Id}

2)When we have to navigate to the child new record page with default values from the parent Related List then we  have to follow the below step:

  • Create a list button URL type with the following url
  • /lightning/o/<child_Object_APIName>/new?defaultFieldValues=<FieldAPIName1>=<value>,<FieldAPIName2>=<Value>&navigationLocation=RELATED_LIST&backgroundContext=/lightning/r/<ParentObjectAPINName>/<ParentObjectRecordId>/view
  • Eg:
  • /lightning/o/Contact/new?defaultFieldValues=LastName={!URLENCODE(Account.Name)},AccountId={!Account.Id}&navigationLocation=RELATED_LIST&backgroundContext=/lightning/r/Acccount/{!Account.Id}/view


Note:

We shouldn't use standard button API Names as Custom Buttton API Names.

Reference:

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


1 comment:

What’s the difference between Einstein Article Recommendations and Suggested Articles?

How Does Einstein Article Recommendations Work? Einstein Article Recommendations helps support agents resolve customer cases efficiently by ...