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
vinita kumari 8vinita kumari 8 

How to access outside package code from Managed Package Code

Hi,

I have developed a functionality in Managed Package which need to access org specific VF page (VF page is mentioned in Custom setting).
When the package code calls the page to generate the a PDF its gives error.
// Managed package code
PDFSetting = PDFCustomSetting__c.getOrgDefaults();
String pagename = PDFSetting.PDF_Page_Name__c.trim();       // VF page name defined in custom setting
PageReference pdfPage = new PageReference('/apex/'+pagename+'?id='+record.id);  

Error: PDF generation failed. Check the page markup is valid 

Please suggest a solution to access the page or anyother workaround to generate PDF from package code.
            
Siddharth83JainSiddharth83Jain
Hi Vinita,

Are you able to access and view that page correctly while opening it as standalone page. Please make sure that page name is correctly being passed.

Please mark this as best abswer if it helps

Thanks
Siddharth
OSI Consulting
vinita kumari 8vinita kumari 8
Yes, I can access and view page correctly and it opens correctly as standalone page and page name is also passed correctly.

There are some of my observation details:
1. When I passed Package page name (a different page which is a part of package) in custom setting. It works perfectly fine.
2. When I copied package code on that org and then passed the page name (which is currently showing error ) in custom setting it works fine.

It looks like package code works fine package pdfpage.  And code copied to org from package works fine with pdfpage written on that org.
Is there any limitation that package code will not able to access the org code???