I've got a Custom Object called Opportunity__c
and a Custom Button (onClick JavaScript) called Convert_to_Vacancy
. Finally, I've got a Visualforce Page called Opportunity
that overrides the record's View.
I'm trying to make use of the button and include it in the Opportunity
Visualforce Page, but I'm not having a lot of luck doing something I thought would be simple.
I've tried:
<apex:commandButton action="{!$Action.Opportunity__c.Convert_to_Vacancy}" value="Convert to Vacancy" />
But this won't work, the response is a load of JSON my IDE can't parse.
<apex:commandButton action="{!Convert_to_Vacancy}" value="Convert to Vacancy" />
But this won't work (as expected) because of this error:
Unknown method 'Opportunity__cStandardController.Convert_to_Vacancy()
And
<apex:commandButton action="{!URLFOR($Action.Opportunity__c.Convert_to_Vacancy)}" value="Convert to Vacancy" />
Which redirects me to a Page that doesn't exist, regardless of whether I add Opportunity__c.Id
as a parameter in URLFOR
.
I'm lost here, how do I include an onClick JavaScript button on a Visualforce Page that overrides the standard view?