Skip to main content
We are transitioning to Lightning. I have created new Lightning versions of our old URL hack buttons for most objects. However I am struggling with this one. Here's the process:

 

Go to the "Lead Gen Appointment" related list on the Opportunity object

 

Click the custom "New" button to create a new Lead Gen Appointment record

 

The Lead Gen Appointment record name, "Related Account" lookup field and "Related Opportunity" lookup field should all pre-populate. 

 

So far I can get the Name of the record to pre-populate with the name of the related Account. 

 

However, I haven't been able to get the lookup fields for the related Account and Opportunity to populate. 

 

Here's my list button currently which only populates the record Name:

 

/lightning/o/Lead_Gen_Appointment__c/new?defaultFieldValues=

 

Name={!Account.Name},

 

{!Lead_Gen_Appointment__c.Related_Account__c}={!Account.Id},

 

{!Lead_Gen_Appointment__c.Related_Opportunity__c}={!Opportunity.Id}

 

Getting lookup fields on custom object to populate with related record when creating new related object record

 

Does anyone know how to get thos two lookups to pre-populate? 

 

Any help is much appreciated! 
4 answers
  1. May 20, 2021, 11:01 PM
    Hi Jessica,

     

    I think it's a bug that you can't get the opportunity id even though it's an opportunity page.

     

    I have encountered the phenomenon that the Id of the lookup field cannot be obtained.

     

    At this time, I purposely created a text type formula item to avoid it.

     

    Maybe Id type can't be used?

     

    https://trailblazer.salesforce.com/ideaView?id=0873A0000003W5qQAE

     

     
0/9000