I'm using lightning URL hacking to clone an opportunity where it is unable to fetch the custom lookup field value from Opportunity to the new cloned record while it is able to copy the AccountId(Standard Lookup). Can someone point me what I might be missing here? FYI - I have tried Agency__r.Id={!Opportunity.Agency__r.Id} which didn't work as well.


2 Answers 2


Instead of Agency__r.Id={!Opportunity.Agency__c}

try Agency__c={!Opportunity.Agency__c}

the __r.Id notation is for traversing up relationships that exist. Since this relationship doesn't exist, you need to set the __c field with the Id value.

This would work as well: Agency__c={!Opportunity.Agency__r.Id}


Thanks Jeff! I tried these combinations before but for some reason, they didn't work & was throwing an error for Opp.Agency__r.Id. However, I was able to figure it out & looks like Salesforce api name interpretation is different to apex vs merge field especially in URL hacking The following worked for me Agency__c={!Opportunity.AgencyId__c} where Agency__r.Id is expected to be AgencyId__c (which is weird) in URL hacking. Good to know :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .