2

thank you for your reply.

I need to create Quick Action - generate PDF on opportunity object. i have PDF visualforce page and custom controller. If i want to add my vf page in Quick action i get error:

enter image description here

As I understand it, in order for the page to be displayed in this field I need a standard controller, but I have a custom controller. How could I fix this error? Maybe I need to change my controller? Or other what can i do...

My VF Pages look like:

enter image description here

Thanks for your reply!

2 Answers 2

1

If you want to use a Custom Controller and you still need to use the standard controller functions you can use a Controller Extension.

Change your Header to like this:

<apex:page standardController="Opportunity" extensions="controllerTest">

You would also need to modify your controller to handle the Opportunity. Like this:

private final Opportunity oppt;

// The extension constructor initializes the private member
// variable oppt by using the getRecord method from the standard
// controller.
public controllerTest(ApexPages.StandardController stdController) {
    this.oppt = (Opportunity)stdController.getRecord();
}

This gives you the best of both worlds. Allows you to use the standard controller while still being able to write custom methods if needed.

1
  • thats work, thank you.
    – Bogdan
    Jan 22 at 9:34
2

In order, to make VF page available, to select as Opportunity new action, your apex page should have property standardController="Opportunity" e.g.

<apex:page standardController="Opportunity">
...
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.