I have a custom button that skips the record type selection screen. I'd like the Save and New button on the entry screen to also skip the record type selection screen. Is there a way to pass in parameters on the first button that will affect the behavior of the Save and New button?

  • 1
    So far, I'm thinking about just using the saveURL parameter in my button and telling the users to not use Save and New. Not perfect, but it works. Mar 29, 2013 at 21:58

1 Answer 1


You can use a technique referred to as "URL Hacking" to accomplish this.

The idea behind URL hacking is that when you're writing a button, or a link -- anything with a URL, you can pre-populate certain fields with data from the URL itself.

First, a little background. Forms -- those bits of a web page that accept information from a user have two general ways of transmitting that data back to the server. 1: POST DATA, this is the more advanced but more common data transmission method as it allows for things like file uploads, and much larger forms. 2: URL Parameters, This is where each form variable is HTML Encoded and appended in a key=value format to the URL. You've no doubt seen this where the URL's look like: www.example.com/awesomePage?id=123&variable1=hello&varaible2=world

In general, while not officially supported, most salesforce pages will accept inputs through URL parameters OR POST Data. Thus, if you know the key of the data you want to set, you can set that data via a custom button by appending that key=data bit to the url. There are a couple of considerations to keep in mind, however. 1: The first key,value pair is demarcated from the page url with a '?'. After the first key,value pair, all others are separated by '&' signs. Remember that url example from above? note that the id=123 has a ? before it, but variable1 and variable2 both have &'s in front.

Now the hardest part of this is often discovering what the name of the KEY is. Truth is, you can always find it from reading the source, but that is often an exercise in mind numbing frustration. HTML is too <<< >>> pointy.

https://www.squarefree.com/bookmarklets/forms.html has a list of form related javascript bookmarklets - One of which is called FrmGet. FrmGet will translate POST Data forms to Url Parameter forms which can make it easier to find the key your looking for.

So if you've read this far -- Congratulations, you know the theory behind what you want to do. Bored yet? In the end what you want to is create a button that has a url something like instance.salesforce.com/path/page?recordTypeId=<<<RECORDTYPEID>>>

  • He's already done that, per his "I have a custom button that skips the record type selection screen" - the problem he has is overriding the behavior of the follow-on "Save & New" button to also override the record type selector. I don't know of a non-super-hack way to do this.
    – jkraybill
    Mar 28, 2013 at 23:17
  • doh! egg on my face.
    – Kevin P
    Mar 29, 2013 at 0:44
  • 1
    As far as your comment on finding out the field names, I just use Chrome to inspect the element. Super easy way to get the ID of any field on the page. Mar 29, 2013 at 21:55

You must log in to answer this question.

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