I've spent the last few hours looking at various articles and posts trying to find an answer with no luck. I'm trying to create a button using URL Hacking (I know some people frown on it with my skills it's the only way I can do it)

The Scenario:

I have a custom object called Training Form which I would like to add a button to the page layout to create a Case pre-filling the new Case with some of the fields for the Training Form. I've managed to get most of it working except for the following:

  1. I would like the Case.Account field to be populated with the related Account from the training form. I am aware of the need of a -lkid reference for the id as well as the account name but however I format the URL it does not fill in Case.Account.
  2. I'd also like to populate another lookup with a link back to the Training Form as well. Pretty much the same as 1.

Here's the url I have with parts I am struggling with highlighted in bold:


Where am I going wrong?

1 Answer 1


Using the merge fields for field names won't work. You have to inspect your page's source code to determine the correct values. Custom fields are usually named by their field ID, possibly prefixed by CF (for field types that need to be referenced in JavaScript, such as Lookup fields). For example, if I were doing this in my org, using a different field I have as a demonstration, I'd write:


Remember to use URLENCODE for any values which may contain punctuation, otherwise your URL may not work correctly for all values.

Note: I took a guess at some of the field merge values, which may be incorrect. Please check your API names.

  • Many thanks for your prompt response. I've had another go at it after your excellent advice and I've sorted it. However the URLENCODE statement rendered the pre-filled Case data in HTML so I had to remove them. I've tested with a few problem causing alphanumerics in a Training Form( ie: {}()/e?) and none of them seemed to cause a problem with the generation of the new Case with correctly rendered data. Many thanks for your help
    – Chris
    Commented Apr 29, 2017 at 15:39

You must log in to answer this question.

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