2

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?

4

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

| improve this answer | |
  • 1
    Boom, and it works! Answered so fast I can't even click the answer button yet. BTW, I've seen/read that link you shared about a dozen times now. Seems to be the authoritative source on URL hacking in salesforce on the web right now. That's where I got the clarification on what the CF and lkid meant. But I don't think it says anything about needing both the Name and ID fields passed together, so thank you for that clarification. – smohyee May 1 '14 at 20:55
  • @smohyee most welcome, URL hacking has become more a need than a fancy feature lately :).Glad I could help – Rao May 1 '14 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.