+ Start a Discussion
BManojKumarBManojKumar 

Existing opportunity Custom Button in Visualforce page

Hi All,

 

I have a custom button in opportunity object. I have a visual force page . What I would like to perform is, I want to place the custom button in the visual force page. Please help me out to achieve this.

 

Thanks in Advance.

 

Manoj

 

 

Best Answer chosen by Admin (Salesforce Developers) 
BManojKumarBManojKumar

Hi Krishnag,

 

I found the way to use the custom button in visual force page. Actually I was using the button to create the new opportunity in visual force page as,

 

<apex:commandButton action="{!URLFOR($Action.Opportunity.New)}" value="New Opportunity"/>

 

I just modified the action for the custom button as,

 

<apex:commandButton action="{!URLFOR($Action.Opportunity.New_TEST)}" value="Test Button"/>

 

where New_TEST is the desired custom button.

 

Tons of thanks

 

Manoj

All Answers

krishnagkrishnag

hi manoj, 

 

can u eloborate your task. As of my understanding you want to create a button on VF page with the functionality same as what it does on standard page right?

 

If so since its is button on standard object you can directly use standard controller opportunity on VF page and create a botton and give the action as action{!custombutton)

BManojKumarBManojKumar

Hi Krishnag,

 

Yes.. You are right.. I have a custom button on Opportunity object. It has some business logic in it. I have pasted the url pattern of that button below.

 

https://cs3.salesforce.com/006/e?ent=Opportunity&nooverride=1&RecordType={!IF( User.Account__c <> '','012Q0000000CmCZ','012300000004ISx')}&retURL=%2F006%2Fo&{!IF( User.Account__c <> '','opp4','')}={!IF( User.Account__c <> '',User.Account__c,'')}

 

Can you guide me how to use this button in visual force page ?

 

Thanks

Manoj

BManojKumarBManojKumar

Hi Krishnag,

 

I found the way to use the custom button in visual force page. Actually I was using the button to create the new opportunity in visual force page as,

 

<apex:commandButton action="{!URLFOR($Action.Opportunity.New)}" value="New Opportunity"/>

 

I just modified the action for the custom button as,

 

<apex:commandButton action="{!URLFOR($Action.Opportunity.New_TEST)}" value="Test Button"/>

 

where New_TEST is the desired custom button.

 

Tons of thanks

 

Manoj

This was selected as the best answer