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
ssssssssssssss 

AutoPopulating a lookup field on click of button in related list

Hi,

 

 

I have 2 custom objects, Customer and Call Log. There's a lookup from Call Log to Customer. So, i have a related list 'Call Logs' on Customer detail page.

 

I have overriden the 'New' button on the related list, so when now the button is pressed, it redirects to the actual new record creation page, and also auto populates some values, including the lookup field to Customer with the name of the customer.

 

The code behind the button is:

 

/a07/e?CF00NA0000006AZ2f={!Customer__c.Name}&retURL=%2F{!Customer__c.Id}&RecordType=012A000000177i9&ent=01IA0000001TSOU

 CF00NA0000006AZ2f = the lookup field id (retreived from firebug)

 

Scenario:

 

Now, it works absolutely fine. But the thing is, since i am populating the lookup field with the name, if there are 2 customers by the name of "ABC", then both appear in edit page lookup field dropdown. The user is given an option to select one, and he, if sees the same name can select the incorrect one also.

 

 

Can anyone help me with this please?

 

Thanks,

Sumit

Best Answer chosen by Admin (Salesforce Developers) 
nylonnylon

Hi,

Add this and see if it works:

 

&CF00NA0000006AZ2f_lkid={!Customer__c.Id}

 

All Answers

nylonnylon

Hi,

Add this and see if it works:

 

&CF00NA0000006AZ2f_lkid={!Customer__c.Id}

 

This was selected as the best answer
ssssssssssssss

Thanks!! It worked like a charm!!

 

Actually I tried this thing already..but this time I used both CF00NA0000006AZ2f={!Customer__c.Name} and &CF00NA0000006AZ2f_lkid={!Customer__c.Id}...so the final URL that came up is:

 

/a07/e?CF00NA0000006AZ2f={!Customer__c.Name}&retURL=%2F{!Customer__c.Id}&CF00NA0000006AZ2f_lkid={!Customer__c.Id}&RecordType=012A000000177i9&ent=01IA0000001TSOU