Find your content:

Search form

You are here

How does work? Can we show layout for a new record?

 
Share

Can we use <apex:detail> to get the layout of standard object on a VF page.

<apex:page standardcontroller ="Event">
<apex:detail subject="{!Event.Id}"/>
</apex:page>

I can view the event record by using the above code. But i wanted to see if we can use apex:detail to add new record. If i remove subject="{!Event.Id}" then we have a blank screen.

Is there anyway we have the layout for new record built in VF page?

Thanks


Attribution to: Prady

Possible Suggestion/Solution #1

Follow the steps to override the Event's New button with a VF page

1.Create a VF page 'NewEventPage' with the following code

<apex:page standardController="Event">
<!-- Add the fields that you need -->
</apex:page>

2.Go to Setup -> Customize -> Activities -> Events Buttons and links

3.Edit new button, now the created 'NewEventPage' will be displayed in the 'Override with' options

4.Select the page and save

5.Now if you click 'New' button, the VF page will be displayed.

Adding comment to the answer:

The <apex:detail> is for already created record. You can edit the already existing record in the <apex:detail> tag using inlineEdit attribute. But in you case you want to create a new record, so you should create a VF page with all the fields that you need. If you have a recordtype for event, then its your choice to select the record type or not while overriding 'New' button with an option 'Skip Record Type Selection Page'


Attribution to: Priyanka
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4798

My Block Status

My Block Content