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
jyostjyost 

Prepopulate via url

This is not rocket science, but this is my first go round with custom buttons...

 

I have a custom object as a related list on a Contact page - I want to create a custom button that will prepopulate some data on the new custom object.  The info I want to use is the Contact Name and Mailing Address.

 

The Mailing Address is coming over with out problem but I just can't figure out the Contact name.

 

Here is what I am using:

 

 /a0N/e?00N30000003gob0={!Contact.Name}&00N30000003hsZX={! Contact.MailingAddress }

 

 

The custom object create new record screen shows the Contact Name in the url but it does not populate the Contact lookup field. I've read references to using "_lkid" and the Contact ID but was unsure how/what that does. Any help or feedback is greatly apprecaited. Thanks!!

SteveBowerSteveBower

Just offhand, if the first parameter, 00N30000003gob0 in your example, is the Id of the Contact Lookup field from the Edit screen, then instead of using {!Contact.Name}, use {!Contact.Id}. 

 

That way you're populating the lookup reference with the ID of the Contact.  It will automatically figure out what the Contact name is and display it in the detail view.

 

Best, Steve.

 

jyostjyost

Thanks for the info Steve.

 

I did make that change but it didn't seem to help. I'm sure it's something small that I'm missing. As before I can see the returned Contact ID in the url but it's just not populating the Contact lookup field.

 

To confirm - The first parameter is the Contact lookup field from the Edit screen.

jyostjyost
Bump... any other thoughts?
jyostjyost

Got it...

 

This url prepopulates the Contact Name and Contact mailing address into our custom object:

 

/a0N/e?CF00N30000003gob0={!Contact.Name}&CF00N30000003gob0_lkid={!Contact.Id}&00N30000003hsZX={! Contact.MailingAddress }

 

I was missing the "CF" at the begining of the contact ID and contact name fields. It's always something small.