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
Ramesh SomalagariRamesh Somalagari 

Visual force Page not displayed when the Account is updating

I have created VF Page it is attached to Account Object.Now when I click the standard (System default)"Edit" Button on Account Object my VF is not getting displayed,After I click the standard (System default)"Save" Button my VF page is displayed.

Can my VF page be displayed when the Account Object is edited ?

Please let met know.

VF Page

<apex:page standardController="Account"  extensions="NewAndExistingController" id="demoId" >     
    <apex:form >   
        <apex:pageBlock >
            <apex:commandButton value="Call visualforce Page" action="{!click}"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller:

public class NewAndExistingController {
    Public Account a= new Account();
    public NewAndExistingController(ApexPages.StandardController controller) {
        try{
            a =[select id,name from account where id=:controller.getId()];
        }catch(exception e){}
    } 
    public PageReference click() {
        PageReference openvfpage = New Pagereference('/apex'+'/XXXXVF'+'?aid='+a.id);//calling to another VF page
        openvfpage.setRedirect(false);
        return openvfpage ; 
    }
    public NewAndExistingController() {  }
}
Best Regards,
Ramesh
Sonam_SFDCSonam_SFDC
Hi Ramesh,

We can only add VF components on detail pages only.
As for a workaround, one approach could be to override the standard edit page with a VF page.
Ramesh SomalagariRamesh Somalagari
Can you share the sample code for  override the standard edit page with a VF page.



Thanks you Sanam for quick responce