Trending Topics: Latest from our forums (November 2020)
Here are some of the latest popular questions that the Docusign developers community asked on Stack Overflow in the month of November 2020.
Table of contents
Here are some of the latest popular questions that the Docusign developers community asked on Stack Overflow in the month of November 2020. You too can ask questions by using the tag docusignapi in Stack Overflow.
Thread: Docusign Template is no merging with APEX code
https://stackoverflow.com/questions/64669971
Summary: The developer is using the Docusign Apex Toolkit with a custom button that is designed to send an envelope based on a template utilizing custom fields to merge data from Salesforce into Docusign. This is the Apex code they were trying to use:
//create the emptyenvelope connecting it to the SF object
myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(new dfsle.Entity(**mySourceId**)); // use the Recipient.fromSource method to create the Recipient
dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(
sender.name, // Recipient name
sender.eAddress, // Recipient email
null, //Optional phone number
sender.role, //Role Name. Specify the exact role name from template
new dfsle.Entity(**mySourceId**)); //source object for the Recipient
//add email detail for the envelope
myEnvelope = myEnvelope.withEmail(settingsDocusignTemplate.get(
sourceName).email_subject__c,
settingsDocusignTemplate.get(sourceName).email_body__c);
//Could provide automatic notifications as well based off of criteria
final boolean dfsle_reminder = settingsDocusignTemplate.get(sourceName).reminder__c;
final integer dfsle_remindAfterDays = Integer.valueOf(settingsDocusignTemplate.get(sourceName).remindAfterDays__c); // wait before sending reminder
// add Recipient to the Envelope
myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient });
//create a new document for the Envelope
dfsle.Document myDocument = dfsle.Document.fromTemplate((dfsle.UUID)templateInfo.get('UUID'), // templateId in dfsle.UUID
format (String)templateInfo.get('name')); // name of the template
//add document to the Envelope
myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });
try { System.debug('\tSending Envelope'); dfsle.EnvelopeService.sendEnvelope(myEnvelope, // The envelope to send true);
// Send now?
} catch (dfsle.DocuSignException docusignExcpt) {
ErrorLogUtil.createErrorLogData(docusignExcpt,CLASS_NAME,METHOD_NAME,null,null);
} catch (Exception excp) {
ErrorLogUtil.createErrorLogData(excp,CLASS_NAME,METHOD_NAME,null,null);
}
Answer: The Merge Fields feature requires custom fields in Docusign, and they do not get included by default. You have to add the following code to create the documents slightly differently than the way the developer had it above.
String opptyStr = (String) myOpportunity.Id + '~Opportunity';
dfsle.CustomField myField = new dfsle.CustomField ('text', 'DSFSSourceObjectId', opptyStr, null, false, false); //add document to the Envelope
myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument }) .withCustomFields(new List<dfsle.CustomField> {myField});
Thread: Docusign Android SDK integration
https://stackoverflow.com/questions/64859733/
Summary: The developer is using the Docusign Android SDK and trying to obtain an access token using JWT. They are also using the C# eSign SDK (.NET Core) and getting a "Invalid access token" error from the RequestJWTUserToken API call from that SDK.
Answer: Using the Android SDK, there are methods to handle JWT tokens and there’s no need to also use the C# SDK. Also, when you use JWT to generate an access token, the access token lifetime is one hour. After the token is expired, if you use the Android SDK signOnline() API, when it returns a SigningException with an 'Invalid access token' message, and that is expected. In the Android SDK login() API call, make sure that you pass the token expiration value for the expiresIn attribute. So, after the new access token is generated via JWT, the token expiration value should be passed in the SDK login() api. You can use the Android SDK authenticaionDelegate.isSessionActive() API callto know if the access token is expired/valid.
Thread: Docusign JWT Authentication .p12 needed instead of PEM
https://stackoverflow.com/questions/64728444/
Summary: The developer is trying to authenticate using JWT. They obtained an RSA key pair and would like to store it as a .p12 file format required for SAP. They have a .PEM file format and are not sure how to convert.
Answer: Docusign currently does not support the .p12 file format for the purpose of RSA key pair usage. The way most developers use the key pair is by using the private key only as a text file. You can also use a PEM file format that is supported by Docusign. You can convert a PEM file into a .p12 file using the openssl tool by running the following command:
openssl pkcs12 -export -out Cert.p12 -in cert.pem -inkey key.pem -passin pass:root -passout pass:root
Additional resources
Inbar Gazit has been with Docusign since 2013 in various engineering roles. Since 2019 he has focused on developer content. Inbar works on code examples including the launchers, available on GitHub in eight languages, and helps build sample apps showcasing the various Docusign APIs. He is also active on StackOverflow, answering your questions. Inbar can be reached at inbar.gazit@docusign.com.
Related posts