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
Nikhil Shrigod 17Nikhil Shrigod 17 

Diasplaying a visualforce page on clicking a button that is on accounts detail page

Can anyone please tell me that how can we display a visualforce page on clicking a button that is on accounts object's detail page?
Best Answer chosen by Nikhil Shrigod 17
v varaprasadv varaprasad
Hi Nikhil.

Create one standard controller visual force page Like sample below : 
<apex:page standarcontroller="Account" sidebar="false">
    
    <apex:pageBlock title="Account Summary">
        <apex:pageBlockSection>
        	
            Name: {! Account.Name } <br/>
            Phone: {! Account.Phone } <br/>
            Industry: {! Account.Industry } <br/>
            Revenue: {! Account.AnnualRevenue } <br/>
            
        </apex:pageBlockSection>
    </apex:pageBlock>
    
</apex:page>

Then go to custom buttons on Accounts section :  

User-added image

If you need any further help, feel free to contact me.


Thanks
Varaprasad

All Answers

v varaprasadv varaprasad
Hi Nikhil.

Create one standard controller visual force page Like sample below : 
<apex:page standarcontroller="Account" sidebar="false">
    
    <apex:pageBlock title="Account Summary">
        <apex:pageBlockSection>
        	
            Name: {! Account.Name } <br/>
            Phone: {! Account.Phone } <br/>
            Industry: {! Account.Industry } <br/>
            Revenue: {! Account.AnnualRevenue } <br/>
            
        </apex:pageBlockSection>
    </apex:pageBlock>
    
</apex:page>

Then go to custom buttons on Accounts section :  

User-added image

If you need any further help, feel free to contact me.


Thanks
Varaprasad
This was selected as the best answer
Alisha Mehta 9Alisha Mehta 9

Hi,

Here is an example -
1) Store a button you want as image in static resource.
2) Create a formula field as return type text and enter as below- 
HYPERLINK("/apex/HelloWorld2", IMAGE("/resource/Check","Check") )
First parameter is visualforce pagename , Second is link of image in the static resource.