I have a scenario PDF needs to be created and attached the same to custom object upon user approval. Users will approve through email approval process.
Challenges:
Create a PDF using visualforce page
a.Salesforce has limitation to use getContent() or getContentAsPDF() methods in trigger & callout.
b. We are using same VF page in other button clicks to view PDF.
- Getting Seession ID
I found following methods to create PDF:
Web Service
a. Once user approved the record, Trigger will invoke the webservice using callout.
b. Getting session id with the help of partner wsdl. (Hardcoded username & password)
c. It works now, but user login credentials are hard coded, what is the best practice for this?
Email Service
a. Once user approved the record, PDF will be sent as an attachment(visualforce email template) using email alert. b. Created email service to parse the inbound email and attach PDF to Custom object
c. Sending Empty email
Any other suggestion to generate PDF which can fit into this scenario. Please advise