1

How do i customize the page layout for just the page that renders when I am adding a new account?

  • Can you describe your question. Which page you are referring . it is a custom page? Share the code if it is custom page. – Tushar Sharma Dec 7 '15 at 16:49
0

I assume that what you meant to ask is if you can customize the "edit" page layout so it is different than the "read" page layout. If this the case, then I am afraid you cannot do this without VisualForce.

Salesforce will remove from the "Edit" page most of the "read only" fields when you go in edit mode, but will not let you add/remove fields that are writeable and exist in the standard page layout for the object.

=== Sample Code for a Custom VF Edit Page (No Apex) ==

<apex:page standardController="MyObject__c">

  <apex:form id="theForm">

    <apex:sectionHeader title="{!$ObjectType.MyObject__c.label}" subtitle="{!MyObject__c.Name}" />

  <apex:pageMessages id="messages"/>
    <apex:pageBlock> 
      <apex:pageBlockButtons>
        <apex:commandButton value="Save" action="{!save}" />
        <apex:commandButton value="Cancel" action="{!cancel}" />
      </apex:pageBlockButtons>
    </apex:pageBlock/>

    <apex:pageBlockSection title="" collapsible="false" columns="2">
      <apex:inputField value="{!MyObject__c.Field1__c}" />
       <!-- Add the Rest of the Fields you want to display -->
   </apex:pageBlockSection>

  <!-- You can also add more titles/fields down here-->
     </apex:pageBlock> 
  </apex:form>

</apex:page>

After you created the page, go to Create -> Objects -> MyObject__c. Then scroll down to "Buttons, Links, and Actions" and hit "Edit" next to "Edit" (I know!). Select "Visualforce Page" and then pick the page you just created. Voila!

  • 1
    Note also that what fields appear as editable are controlled by running user's profile – cropredy Dec 7 '15 at 18:37
  • yea I am pretty sure the edit and new are same layout so yes. How do i set my visual force page to the edit page? is there anyway to keep the same page layout and just override the save button with a custom visualforce page? – jaaaaaahhhhh Dec 7 '15 at 18:38
  • Yes! I'll add sample code – Sebastian Kessel Dec 7 '15 at 18:38
  • Added sample code, feel free to reach me privately if there are typos or you want more pointers in how to further customize that VF – Sebastian Kessel Dec 7 '15 at 18:44
  • awesome, thank you. I am guessing it is similar/possible with a standard object? like account – jaaaaaahhhhh Dec 7 '15 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.