I am using Apex Toolkit to generate the document and send envelope for signing. Envelope is sent. I need also to save generated document in Salesforce as a File. I fount that I can use dfsle.Document.WriteBack and it is working, but it saves only the File after the signer will sign. How can I save the original generated pdf once envelope is sent?
This works to save SIGNED pdf: myEnvelope.withOptions(new dfsle.Envelope.Options( // Whether to populate auto-place tags for default roles false, new dfsle.Document.WriteBack( // Where to link the completed document(s) mySourceId, // The completed document(s) file name format dfsle.Document.WRITE_BACK_ENVELOPE_STATUS_PDF, // Whether to combine all the documents into a single PDF true, // Whether to include the Certificate of Completion (CoC) true), // Envelope status event updates new Map<String, Map<String, Object>> { // Set Opportunity.StageName to "Closed Won" upon completion dfsle.Envelope.STATUS_COMPLETED => new Map<String, Object> { } }, // Recipient status event updates new Map<String, Map<String, Object>>()));
I need the code also to save GENERATED pdf once envelope is sent
Unfortunately this isn't possible with the DocuSign Apps Launcher. In DAL you can only writeback when the event is completed. If you're using the legacy DocuSign for Salesforce package you can set up a custom Connect configuration to do this. You can use the "sent" document event and writeback when that event has occurred.