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?


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? Dec 11, 2013 at 10:06
  • are you using an email handler to parse the approval email or using the standard functionality?
    – PepeFloyd
    Dec 11, 2013 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, 2013 at 10:17
  • @eyescream thinking exactly the same, hence the question... :-) Dec 11, 2013 at 11:32
  • 2
    Could you not just generate the PDF in a @future method called from the trigger?
    – Matt Lacey
    Dec 12, 2013 at 0:46

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .