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
Ron-LONRon-LON 

Override "New" button on related list of child object

Hi,

 

I've got a custom object called "Meeting Note" on a parent-child relationship off of Account.  In the related list area there's the usual "New Meeting Note" button.  When you press it, you get a new Meeting Note record in edit mode, with the account information populated in already.

 

I would like to launch a visualforce page there instead, but I also want the behavior to be the same -- where the parent account info is already populated.

 

Just for comparison's sake, I added a new button called "Meeting Note 2."   I tried to make the Content Source "Visualforce Page" but then my page (markup below) doesn't come up as a choice in the dropdown list.  Is there something missing?

 

So what I did instead just for giggles was I made the Content Source "URL" and put in /apex/meetingnote as the URL.  I'm sure I can take this a step further and pass in the Account.Id value into the URL and maybe go from there.  But I get the feeling there's just something small missing that's keeping it from working the way I'd have expected it to??

 

Any help is appreciated!! :smileyhappy:

<apex:page standardController="Meeting_Note__c" extensions="meetingNoteAccountController">
 <apex:form >
        <apex:pageBlock mode="edit" title="Meeting Note Detail">
            <apex:pageBlockButtons location="top">
               <apex:commandButton value="Next" action="{!next}"/>
            </apex:pageBlockButtons>
            <apex:pageMessages /> 

          <apex:pageBlockSection id="Section1a" columns="2">
            <apex:inputField required="true" value="{!Meeting_Note__c.Name}" />
            <apex:inputField required="true" value="{!Meeting_Note__c.Account__c}" />
          </apex:pageBlockSection>


</apex:pageBlock>
</apex:form>
</apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

The best way to do this (and the way that is supported) is to override the New action of Meeting_Note__c.  Go to Setup -> Create -> Objects, click on your Meeting Note object, then in the Buttons and Links section, edit the new action and and select your meetingnote page.

 

The only caveat is that this page will also be the one that's used universally when you create a new meeting note.  If that's not what you want there might be some conditional redirection you can do, but if this is okay with you then it should solve your problem.