function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sumithasumitha 

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.

Thanks,
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.

Thanks!
Raquib
sumithasumitha
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.

Thanks,
Sumitha P

 
sumithasumitha
Hi,

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.
sumithasumitha
Hi,

Please Suggest still receiving same error.

Thanks in advance.
Sumitha P