0

I am trying to create a button that will create a new record related to the record I am on. The issue is that I cannot get the lookup relationship from the related to master to populate on default like it does with the standard related list new button. This is what I have right now any thoughts or ideas on how to update this so it will work properly?

{!URLFOR($Action.Sales_History__c.New, null, [Account_Name__c=Id])}
3

I believe the params here are not the API names of the CustomFields, but the names of the HTML fields on the edit page.

If I'm right, the parameters here are simply the query parameters of the URL.

In order to do this sort of thing, you need to find two things: the CustomField Id (which usually starts with 00N, so let's pretend it's 00N111222333444555) and its lkid field, which is hidden. You then set the parameters to something like this:

["00N111222333444555"=Name,"00N111222333444555_lkid"=Id]

I forget the exact syntax, though (double-quotes? single-quotes? no quotes? braces?). Check out more about the lkid hack here: Salesforce URL Hacking - Ability to remove the 'multiple items found' error

  • well now I am getting a syntax error. Found '[' that doesn't seem right. – cmmoutes13 Mar 9 '17 at 19:38
  • @cmmoutes13 As I said, the syntax might be wrong. – Charles Koppelman Mar 9 '17 at 19:58

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.