function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Susmitha Reddy 4Susmitha Reddy 4 

URL hacking in lightning not working for self-lookup relationship

Hi,
I need some help with URL hacking in lightning.
I have self-lookup relation on Product object. I created a New list button on the product to create a child product from related list.

So I am trying to pre-populate the parent product in lookup field and the recordtype. When clicking on the New button from related list it opens a new product window with the correct recordtype but without the name of the product in the lookup field.

URL is something like this

/lightning/o/Product2/new?recordTypeId=............&ParentProduct__c={!Product2.Id}

Thanks in adavnce for help!!
Best Answer chosen by Susmitha Reddy 4
Susmitha Reddy 4Susmitha Reddy 4
On a trail and error approach the following URL works

/lightning/o/Product2/new?recordTypeId=....&defaultFieldValues=ParentProduct__c={!Product2.Id}

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Susmitha,

Are you getting any errors as such?

Thanks.
Susmitha Reddy 4Susmitha Reddy 4
Hi Anutej,
There is no error. The Parent Product lookup field is not populated but Record Type is populated.
Parent Product not populated
Thanks!!
Susmitha Reddy 4Susmitha Reddy 4
On a trail and error approach the following URL works

/lightning/o/Product2/new?recordTypeId=....&defaultFieldValues=ParentProduct__c={!Product2.Id}
This was selected as the best answer