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:

Grounding Prompt Templates with Apex Merge Fields

 Hi, You can include an Apex merge field in a prompt template to surface data retrieved from a SOQL query or an external API. Apex is also u...