I have a button on a Visualforce page defined as:

<apex:commandButton action="{!URLFOR($Action.Object__c.New)}" value="New Detail"/>

The page it is on uses the standard controller of the parent object. I want this button to send the user to a page with the parent object already filled in, rather than have the user select. I know I can use URL parameters to do it, but I'd have to change the parameters for it to work in different orgs. Basically, I want the button to function just like the New button does on the related list.

  • 1
    This is very similar to my question here (salesforce.stackexchange.com/questions/30367/…) where I basically got the answer that it can't be done... (yet). May 20, 2014 at 9:37
  • can you try using a custom setting/ label and ask the admin of the org to update the value as part of install ( maybe a little technical for a basic admin to do)
    – Rao
    May 20, 2014 at 13:42
  • I really want it to be an automatic process. I'd probably use a field describe before creating a custom setting, except field describes don't give you IDs. Grrr. May 20, 2014 at 20:38

1 Answer 1


Looks like you should be able to programmatically generate this URL using Andy Fawcett's Querying Custom Object and Field IDs via Tooling API.

You must log in to answer this question.

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