4

I have to create PDF file in trigger upon user approval through email. Since Getcontent() method is not allowed in trigger, I am using weservice to create PDF.

As user is approving through email only, it is not possible to get the session id to pass webservice.

Is there any way to get session id?

(Or)

is there any other way to create PDF from trigger?

Note: I am using PDF vf page in some other button also, to maintain integrity using the same page.

  • I am using standard Approval process email approval functionality
  • PDF will be stored as attachment to the record
  • Where do you need the PDF to go to after its been generated? Does it need to be stored or emailed? – Andrew Fawcett Dec 11 '13 at 10:06
  • are you using an email handler to parse the approval email or using the standard functionality? – PepeFloyd Dec 11 '13 at 10:09
  • Does it have to be trigger? Can't you add new email alert to the approval? Would need an email template which can be a Visualforce template with PDF attached... – eyescream Dec 11 '13 at 10:17
  • @eyescream thinking exactly the same, hence the question... :-) – Andrew Fawcett Dec 11 '13 at 11:32
  • 2
    Could you not just generate the PDF in a @future method called from the trigger? – Matt Lacey Dec 12 '13 at 0:46
1

I have resolved this issue by getting session id using Partner webservice in future Method which is invoked in trigger.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.