+ Start a Discussion
DrawloopSupportDrawloopSupport 

URLFOR "New" Action with Default for Lookup Field

Let's say you are on the detail view of an Account. This view has a related list for the Contacts under that account. This related list has a "New" button. When you click this button, the new contact form is automatically associated with the account you came from.

 

Now let's assume the same situation with custom objects but the "New" form is being overridden with a Visualforce page that uses inputFields. The child object has record types. I can already get the URL for the regular new action:

 

 

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

 

How can I get the URL for the new action with the parent lookup inputField defaulted?

 

Thanks!