Welcome to Developing with DocuSign.
This episode covers sending a DocuSign template
with the Apex Toolkit.
I am Lauren Dunne, Senior Salesforce Evangelist
on the DocuSign Developer Evangelist Team.
We create content and tools to help you develop your DocuSign
integrations.
In this video, I walk you through how
to leverage the Apex Toolkit, which
is installed with the DocuSign eSignature for Salesforce
Essentials package.
Before I walk you through the steps of sending an envelope,
here are some useful references.
DocuSign University have a course on the Apex Toolkit.
DocuSign Developer Center have guides and code examples
for you to use.
There are also trail heads getting
started with Apex, such as Apex Specialist Super
Badge and Quick Start Apex.
So what is the Apex Toolkit?
The Apex Toolkit is a toolkit for Salesforce developers
to integrate DocuSign into Salesforce apps and processes.
It is similar to a software development kit or SDK.
Or Apex Toolkit exposes a full set
of programmatic objects and methods
that you can call from your Apex code.
To use the Apex Toolkit, there are a few prerequisites.
You will need a Salesforce org, enable my domain
in your Salesforce org, a DocuSign account
or free developer sandbox, and DocuSign eSignature
for Salesforce Essentials integrated
into your Salesforce.
Once complete, log into Salesforce,
head over to Set Up Home.
And in the QuickFind box, type Apex classes.
Select the result Apex Classes.
And when the page loads, select New to create a new class.
First step, create your public class and name it.
I have named mine Apex Toolkit demo.
Then create your public static void method.
Now you can use DocuSign's envelope service
dot send envelope method to create an empty envelope
template definition that will be subsequently completed,
created, and sent.
Here you will specify the source ID or Salesforce ID
of the record in the entity parameter,
which will be used as a source object for the envelope.
To obtain the source ID, go to the Contacts,
Object, select the contact you want to send to.
In the URL, copy the 18-digit Salesforce ID.
Paste it into your Apex class.
Next, you will need to specify from where
to pull the recipient data for the envelope.
This will contain a full set of parameters for the recipient's
role in the signing process, including their role,
authentication, data, status in the workflow,
and contact settings.
In this example, the envelope will have one recipient,
a document signer.
To create a new document, add in the template ID
to the envelope using the document
dot from template method, and pass
in the ID of a valid DocuSign template.
To locate your template ID, log into your DocuSign account.
Select Templates in your top navigation bar.
Locate a template you wish to use.
Click on the eye icon, and copy your ID.
Head back over to your code and paste the ID in.
Once all that is completed, add the envelope service
dot send envelope method.
This passes the set of envelope data
that was completed in the previous three steps
with a send now parameter of true,
indicating that the envelope should be sent immediately,
rather than saved as a draft.
Now Save.
Let's test that it's all working.
Head over to the Developer Console in Salesforce
by clicking the Developer Console under the Quick Access
Menu.
Select Debug.
Open Execute Anonymous Window.
Type in your class name and click Execute.
Your envelope has now sent.
Check the email linked to the source ID
where you sent the document.
You will find a document has just been sent.
You can go ahead and click on the document
and go through the DocuSign experience
that we all know and love.
Now that you have seen how easy it
is to send an envelope with the Apex Toolkit,
you are ready to begin developing
with DocuSign and Salesforce.
Want to know more about DocuSign APIs?
Here are a few more useful resources.
The DocuSign developer center contains guides, how-tos, SDKs,
and lots more resources to help you
learn how to develop integrations with DocuSign.
Don't forget to subscribe to our YouTube channel
for more developing with DocuSign videos.
Thanks for watching.