Find your content:

Search form

You are here

Whats wrong with this custom button URL (prepopulating custom lookup field)

 
Share

I have a custom button URL with only two parameters being passed, the record type ID and an ID being passed to a custom Opportunity lookup field

/500/e?
CF00NC0000005Au31_lkid={!Opportunity.Id}
&RecordType=012C0000000MK5d

The lookup field parameter has both the 'CF' prefix (for custom fields) and '_lkid' suffix (for lookup fields). And yet, when I click the button from the opportunity, the custom lookup field on the Case remains empty (both in Edit view and after I save).

The record type is updated appropriately, just FYI.

Also, if I remove the '_lkid' suffix, then the actual opportunity ID does show up in the field, but of course returns an error since the lookup can't take actual IDs via the UI.

Any ideas?


Attribution to: smohyee

Possible Suggestion/Solution #1

You are missing one other param to which you pass the actual name of the opportunity (when you remove _lkid you are passing the lookupfield name = {!opportunity_Id})

Read this blog for thorough understanding on hop to do URL hacking with lookups

some ID field: e.g. CF00…. This corresponds to the ID of the field that you want to be prepopulated. This will always be the text that is displayed in the box.

{some ID field}_lkid: e.g. CF00…_lkid. If the field in question is a lookup or master-detail, then this field should be set to the resulting record ID {some other ID field}. Note that in this case, the actual non _lkid field is irrelevant, and not consulted.

http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

Answer for your question

/500/e?
CF00NC0000005Au31={!opportunity.name}&
CF00NC0000005Au31_lkid={!Opportunity.Id}
&RecordType=012C0000000MK5d

Should populate the opportunity in the lookup field


Attribution to: Rao
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/34194

My Block Status

My Block Content