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
Soumya Srivastava 1Soumya Srivastava 1 

Not getting content in the PDF attachment when in Lightning.

Hi,

I am not getting a damaged PDF when downloading it from attachment from a Quote object in lighting while same is working in classic. Can you please let me know what will be the appropriate steps to resolve damaged PDF issue as soon as possible.

Thanks,
Soumya
Soumya Srivastava 1Soumya Srivastava 1
Hi Agustina,

Thanks for your help. Can you please explain how can i use new files in apex and pass id in to get the content in attached pdf on attachment which is currently coming as damaged. How can i access an attachment in apex in lighting using child record id?

Please let me know if you have any idea on it.

Thanks,
Soumya
Agustina GarciaAgustina Garcia
Hi Soumya,

Sorry for the very late response.

It's easy. Double check below links with information about Files (the object name is ContentDocument)
  1. https://docs.releasenotes.salesforce.com/en-us/winter16/release-notes/rn_chatter_files_related_list.htm
  2. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocument.htm
Agustina GarciaAgustina Garcia
Something else. Actually you need to create ContentVersion (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_content.htm) because Salesforce does not allow you to create ContentDocument directly.  Then you can create several ContentVersion files with the same ContentDocumentId and the result is several version of the sema File that you can use on File related list.