docusign / code-examples-apex Goto Github PK
View Code? Open in Web Editor NEWApex Toolkit code examples
License: MIT License
Apex Toolkit code examples
License: MIT License
I am using the apex toolkit for one of our use case where we are using the embed signing. The pdf rendered in the screen does not bring the merge fields data from the record.
`trigger ContractConversion on Contract (before update) {
for(Contract con : trigger.new) {
if(con.Status == '03 - Email to Customer') {
sendEnvelope.sendEnvelopeMethod(con.accountId,con.ContractNumber);
}
}
}
public class sendEnvelope {
@future(callout=true)
//add comments about source
public static void sendEnvelopeMethod(Id accountId,string ContractNumber) {
Final String templateGuid = '7635114e-743a-418f-ba6a-1d95a9d51b89';
//TemplateId contains the DocuSign Id of the DocuSign Template
Final dfsle.UUID TemplateId = dfsle.UUID.parse(templateGuid);
Account account = [SELECT Id FROM Account WHERE Id = :accountId
LIMIT 1
];
// Create an empty envelope with Account Id as the source Id
dfsle.Envelope envelope = dfsle.EnvelopeService.getEmptyEnvelope(
new dfsle.Entity(account.Id));
//Find your contact to add
Contact Contact = [SELECT AccountId, Name, Email FROM Contact
WHERE accountId = :accountId
LIMIT 1
];
//use the Recipient.fromSource method to create the Recipient
dfsle.Recipient Recipient = dfsle.Recipient.fromSource(
Contact.Name, // Recipient name
Contact.Email, // Recipient email
null, //Optional phone number
'Customer', //Role Name. Specify the exact role name from template
//source object for the Recipient - Account
new dfsle.Entity(Contact.Id));
//add Recipient to the Envelope
envelope = envelope.withRecipients (
new List<dfsle.Recipient> { Recipient });
//create a new document for the Envelope
dfsle.Document myDocument = dfsle.Document.fromTemplate(
TemplateId, // templateId in dfsle.UUID format
'E-Signature Email Template Contract'); // name of the template
//add document to the Envelope
envelope = envelope.withDocuments(
new List<dfsle.Document> { myDocument });
// Send the envelope.
envelope = dfsle.EnvelopeService.sendEnvelope(
envelope, // The envelope to send
true); // Send now parameter not actually part of this method.
}
}
`
Hi,
I am getting this issue while sending the following code - Please help
Id mySourceId = 'myObjectId'; // The ID of the initiating Salesforce object
String templateId = 'myTemplateId'; // The ID of the DocuSign template
// Create an empty envelope
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(
new dfsle.Entity(mySourceId));
// The initiating Salesforce entity
// Use myEnvelope for later
// We will use a Salesforce contact record as a Recipient here
Contact myContact = [SELECT Id, Name, Email FROM Contact LIMIT 1];
//use the Recipient.fromSource method to create the Recipient
dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(
myContact.Name, // Recipient name
'[email protected]', // Recipient email
null, // Optional phone number
'Signer 1', // Role Name. Specify the exact role name from template
new dfsle.Entity(myContact.Id)); // Source object for the recipient
// Add a recipient to the envelope
myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient });
// myTemplateId contains the DocuSign Id of the DocuSign Template
dfsle.UUID myTemplateId = dfsle.UUID.parse(templateId);
// create a new document for the Envelope
dfsle.Document myDocument = dfsle.Document.fromTemplate(
myTemplateId, // Template Id in dfsle.UUID format
'myTemplate'); // Name of the template
//add document to the envelope
myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });
// Send the envelope
myEnvelope = dfsle.EnvelopeService.sendEnvelope(
myEnvelope, // The envelope to send
true); // True to send the envelope now
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.