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...)
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.
You can create a custom button.On click of button either call Javascript or you can call another VF page.
sample onClick javascript:
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
You can create a custom button.On click of button either call Javascript or you can call another VF page.
sample onClick javascript:
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
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.