function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

$Action.New on Custom Object

I need to create a new child record (Email__c) with the master record ID automatically inserted via outputLink:


<apex:outputLink target="__blank" style="color:blue" value="{!URLFOR($Action.Email__c.New)}">Create New Email</apex:outputLink>


Here is the public page where the link is displayed:


I am using the standard $Action.New but not sure why the record ID isn't passed automatically.  I have gone into set up and overritten the "new" functionality with my new custom page.  The new page displays correctly, but the master record ID isn't displayed.


Please help!


What ID value are you expecting to be passed? When a new record page is shown, there isn't an ID yet, because the data isn't committed to the database.

The Name from the master object. The outputLink is on the master object to create a new child object and i would like the Apartment__c.Name to be automatically inserted.

You'll probably want to supply a custom parameter to the output link that includes the parent ID value "URLFOR($,null,[])". You can then use apexpages.currentpage().getparameters().get('parentid') to get the value from the URL.