You need to sign in to do that
Don't have an account?
Calling a custom button from visualforce
Hi developers,
I am new into Salesforce but already got something! I created a custom view lead page and custom edit lead page.
Now I want to connect this two pages.
1)I created a custom button, that when the user will click on it, will redirect him to the edit visualforce page. The name of the button is "Edit_Fiscal_Info".
2) And here is my question: I want to add this button to the custom visualforce page of the lead, but I get lost in here.
Could someone please provide me with the necessary steps? I think i need to create a standard controller to add this button, but I dont know how to do it....
Thanks a lot.
Antonio
I really appreciate all your help!
I paste the final solution in case it might be useful for someone else.
Visualforce:
ApexClass:
Apex class test:
Hope this will help someone!
Thanks a lot!
Antonio
All Answers
not possible, as since we have separate button components for visual force page we cannot cal the custom buttons.
--yvk
Hi,
Try the below code snippet as reference:
Page
<apex:commandButton value=" Edit_Fiscal_Info " action="{!login}"/>
Controller
public PageReference login()
{
PageReference pageRef= new PageReference('/apex/EditLeadPage);
pageRef.setredirect(true);
return pageRef;
}
Note: EditLeadPage is the name of the Edit Lead VF page.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Not even with an extension?
Is not possible to create a custom button and add it instead of the standar edit in this part of the code?
Instead of the line
I want to add my custom button for edit....
Thanks
Hi,
Thanks a lot for your idea but as I said I am new into visualforce and controllers and I am completely stucked. I tried to implement your idea but this is all the far I got:
I created and apex class:
But I cant deploy it because I need to test it, and I dont know how to test it. I did the following test
But I dont know how to continue....
Could you please guide me a little bit more?
Reaally appreciate it. Thanks
Antonio
Thats It...!!!
Regards,
Shravan
Hi,
Already got to deploy the class and its test as follows:
Now, when I try to call the method from my visualforce page as follows:
And I keep getting de error
Error: Unknown constructor 'LeadExtension.LeadExtension(ApexPages.StandardController controller)'
How can I fix this?
Thanks a lot!
Here is the Mistake...!!!
Dont use brackets in the action.
and also put this code in your class
public LeadExtension(ApexPages.standardController con){
}
as you are using StandardController="Lead" in Your page
Regards,
Shravan
I really appreciate all your help!
I paste the final solution in case it might be useful for someone else.
Visualforce:
ApexClass:
Apex class test:
Hope this will help someone!
Thanks a lot!
Antonio