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
Damien_Damien_ 

Custom Button with Visualforce Content Source in PageLayout

I want to place a custom button in a page layout, that when I click it, it does some work through apex and then returns the PageReference to take me to another page.  The thing I don't know is, do I create a Visualforce Page that only has a single command button on it, and the controller that goes with it, or is there something else I need to do?  Even a link to put me in the right direction would be sufficient for me.

 

I think my main problem is that, when I try to select the Content and choose my page, its not there.  so far for my page I have: (I have also tried a few variations of this, and so I must be doing something wrong...)

 

<apex:page standardController="Case">
  <apex:form >
    <apex:commandButton action="{!save}" />
  </apex:form>
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
AhmedPotAhmedPot

You can create a custom button.On click of button either call Javascript or you can call another VF page.

 

sample onClick javascript&colon;

if('{!Opportunity.Product__c}' == 'PSBL')
window.location.href= "/apex/FAT_LECDetails_VFLAP?id={!Opportunity.Id}";
else
window.location.href= "/apex/FAT_LECDetails_VFLAP?id={!Opportunity.Id}"

 

or VF page with action method which will do some processing and redirect to another page.

 

Hope this can help you

 

Thanks,

Ahmed

 

All Answers

AhmedPotAhmedPot

You can create a custom button.On click of button either call Javascript or you can call another VF page.

 

sample onClick javascript&colon;

if('{!Opportunity.Product__c}' == 'PSBL')
window.location.href= "/apex/FAT_LECDetails_VFLAP?id={!Opportunity.Id}";
else
window.location.href= "/apex/FAT_LECDetails_VFLAP?id={!Opportunity.Id}"

 

or VF page with action method which will do some processing and redirect to another page.

 

Hope this can help you

 

Thanks,

Ahmed

 

This was selected as the best answer
Damien_Damien_

Bah, I just realized that the reason my button didn't show up... was because I had created my page/extension in the wrong project.  Silly mistake to give me a lot of grief.