+ Start a Discussion

Salesforce CPQ - Displaying error while trying to call (GenerateDocument Visual force page) in apex class

Hi All,

When i try to write Page reference
GenerateDocument - It is Visual force page in CPQ Managed Package.It is called when Generate Document button is clicked in Quote Detail Page.
//Quote.id --> retrieves current CPQ Quote id
PageReference pr = new PageReference('apex/GenerateDocument?id=' + quote.id);
                 Attachment at     =   new Attachment();
                 Blob b = pr.getContentAsPDF();
                    at.Body        =  b;
                        at.ParentId   =   quo1.Id;
                 at.ContentType = 'pdf';
                 insert at;
Displays Error as :
core.apexpages.exceptions.ApexPagesGenericException: The page can't be loaded because the remote site apex/GenerateDocument isn't listed in your organization's Remote Sites Settings.
But I try to create new Remote Site  --> but it does not works on my end.

Please Advice and suggest.

Sumitha P
Raquib SFRaquib SF
Hello Sumitha,

Try updating your pageRef to below
PageReference pr = new PageReference('/apex/GenerateDocument?id=' + quote.id);

Please let me know if that solves your issue.

Hi Raquib,

I have changed as per your Suggesstion but Displaying error as "Page GenerateDocument does not exist".

But GenerateDocument Visual force page is present inside the Managed Package (Salesforce CPQ) and I have access to That Visual force page too.

Please Advice.

Sumitha P


I cleared that error by adding

PageReference pr = new PageReference('/apex/SBQQ__GenerateDocument?id=' + quote.id);

But now,it showing as "Error accessing PDF resource"

Please advice

Thanks in advance.

Please Suggest still receiving same error.

Thanks in advance.
Sumitha P