You need to sign in to do that
Don't have an account?
How to hide/show (custom lead convert) button based on field value using visualforce WITHOUT apex?
I want a button to convert a lead to appear on a standard lead page layout, but only under certain conditions. I'm trying to come up with a next-generation way of doing this so that I don't have to create multiple record types and page layouts whose only difference is whether a single button appears (and logic to drive switching record types, etc.). I'm (obviously) new at VF, but perhaps this example can help others as well.
I've tried to create a simple visualforce page that I can include on a standard layout. The page/button appears once I add it to a layout, but it's pretty difficult finding references to exactly how the related button syntax is supposed to work. My example is below.
<apex:page StandardController="Lead" id="ConvertButton">
<apex:form>
<apex:commandButton action="/lead/leadconvert.jsp?retURL=/{!Lead.Id}&id={!Lead.Id}" value="ConvertIt" disabled="{!IF(Lead.Application_Complete__c, 'true', 'false')}"/>
</apex:form>
</apex:page>
(I have a checkbox called "Application Complete" on the Lead object.)
- Is there a standard lead action I can use or do I have to build my own button with my own URL? I can't find any reference to how to make {!Action.Lead.Convert} work here, for instance. Is that possible? It seems like it should but no matter what I try I get a message like "Error: Unknown method 'LeadStandardController.Convert()' " when I try to save the VF page.
- How do I get the URL to launch a new page? When clicking on the button all I get is a page launched within the tiny space where the visualforce page is inserted into the standard layout. I can't find a reference as to how to make it launch into a full new page.
- I can't seem to get the IF statement to work properly. It doesn't generate an error when creating the visualforce page, but it doesn't disable/enable the button properly either. I also tried using "NOT", but without success. Can someone provide an example of how to make these logical functions work properly in this situation?
- I'd like to see this example work (if it is possible) in order to understand VF better, but if there is a better way to achieve my goal I'd also like to hear it.