Question

I'm currently trying to automate the process of creating a docusign document and sending it by putting it into an apex trigger. I have managed to get the docusign api (via WSDL) into my org, and now I'm trying to add the code into the trigger to send out the document. Without pasting the entire code here, I've been following this tutorial and have gotten all of the required code into my trigger. Unfortunatly, when I run it, I get this error:

11:40:49.965 (12965647595)|FATAL_ERROR|System.VisualforceException: Getting content from within triggers is currently not supported.

Trigger.OpportunityTrigger: line 109, column 1

Does this mean that it's not possible to send a document in a trigger? The tutorial sends it through a controller, is that the only currently supported method?

Thank you for any help you can give me!

EDIT: So I've gotten past that error (using a different tutorial), and am now getting this error.

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: This User lacks sufficient permissions. User does not have the permision to the CreateEnvelopeFromTemplates method faultcode=soap:Client faultactor=https://demo.docusign.net/api/3.0/dsapi.asmx

This appears to be a problem with the Docusign user I am using for sending this document. I am currently using CreateEnvelopeFromTemplates to try and send a templated document out to up to 5 recipients.

Was it helpful?

Solution

I ended up phoning into Docusign Support, and asking them about the issue. Turns out that the last error was caused by me trying to authenticate and sign into docusign with my userID not the AccountID (switched those around and the permission error went away).

Another error showed up related to not having roles setup properly in my template (fixed that by setting up the role), and now everything is working fine. I'm answering my own question to leave it as a reference to future searchers.

OTHER TIPS

  1. Create a call out from trigger
  2. Then get the request from a rest method
  3. Then continue to get the pagereference conten

You can find an example here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top