+ Start a Discussion
Soumya Srivastava 1Soumya Srivastava 1 

Not able to use PageReference in lightning. Please help, how to pass id from controller to script.

Hi,

I have a problem with PageReference in lightning where I am not able to get the content in the attachment with PDF when we open it. I am using standard conrtroller of Opportunity and redirecting to another Vf Page where I am using standard controller of Quote where PDF has been generated and attached in attached.
I am getting a damaged PDF in Salesforce1 and getting content in Salesforce Classic. Can anybody , please help on this.

Thanks,
Soumya
SandhyaSandhya (Salesforce Developers) 
Hi,

From Salesforce Knowledge Article:

When developing Visualforce pages for the full site developers can utilize the Page Reference class to control the navigation.This method is not supported in Salesforce1 and may not work as expected. Some pages will load using Page References however this may change with any update and should not be relied on. Salesforce Support is unable to troubleshoot issues that arise from using a Page Reference for navigation in Salesforce1.

Full Description can be found here:

https://help.salesforce.com/HTViewSolution?id=000212840&language=en_US

Lightning experience is similar to Salesforce1 mobile where PageReference is not supported. Instead you should navigate using sforce.one instead.

Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
 
Thanks and Regards
Sandhya

 
Soumya Srivastava 1Soumya Srivastava 1
Hi Sandhya,

I have tried to use use sforce.one.navigateToUrl for redirecting but it is still not working when I attach a PDF on Quote which is giving me damaged PDF. Please let me know why is it working in classic but not in lighting. Please let me know if you need anything in code.

Thanks,
Soumya