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
jls_74_txjls_74_tx 

$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:

 

http://aim.force.com/locatormls/apex/MLS_EmailEBrochureList?id=a19F0000001LuHF

 

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!

sfdcfoxsfdcfox

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.

jls_74_txjls_74_tx
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.
sfdcfoxsfdcfox

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