0

I've created the following URL Hack button.

https://cs24.salesforce.com/a11/e?
 CF00N19000000LoMt_lkid=00119000003Y9T3AAK
 &CF00N19000000LoNI={!Visit_Report__c.Name}

Notice the CF00N19000000LoMt_lkid=00119000003Y9T3AAK

This is the Account ID on a related list that I"m trying to force to a specific account each time record is created. I don't have coding skills to create a trigger for this. Any thoughts on what I'm doing wrong?

Every time I hit the button, it leaves the Account ID field blank.

1
  • 2
    What happens if you add &CF00N19000000LoMt=Test? Commented Jan 22, 2015 at 22:45

3 Answers 3

3

The custom field ID for lookup fields comes in 2 forms, the field ID which takes in the name of the lookup record and also the field ID followed by _lkid which takes in the record ID. What happens in your case, you're setting the lookup ID but not specifying the name of the record, hence it's showing blank. Try appending the name of the record to the URL as well:

&CF00N19000000LoMt=YourRecordName

2

You need to also add the name of the object setting "&CF00N19000000LoMt=A%20Name"

4
  • Can you expand on this answer to educate @Jim about why this is necessary and what the difference is between this and the _lkid parameter?
    – Mark Pond
    Commented Jan 23, 2015 at 2:32
  • 1
    First of all this is not an officially supported way to populate fields when editing records through the standard edit page (so it might not work anymore in the future). Secondly you need to specify both [FIELDID] and [FIELDIF]_lkid because you need to set both the record ID and it's rpimary Name field: this way on load SF loads the object correctly. This is not documented anywhere, it is a purely pragmatic explaination :) Commented Jan 23, 2015 at 15:41
  • Hi All. Thanks. It does work when you append the name of the record to the lookup, however my concern in doing that is somebody will come along and create a duplicate record and will cause my lookup to fail. I know that you can do this with a trigger, however I'm not skilled in coding, so unfortunately this is not an option for me. @enreeco are you saying my code should now look like CF00N19000000LoMt_lkid=A%2000119000003Y9T3AAK Commented Jan 26, 2015 at 15:17
  • No it should be "&CF00N19000000LoMt=Account%20Name&CF00N19000000LoMt_lkid=00119000003Y9T3AAK" Commented Jan 27, 2015 at 16:45
0

Just create formula field that will have lookup field reference. Now refer formula field like below -

YourLookupField__c={!URLENCODE(SObjectApiName.YourFormulaeField__c)}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .