Tuesday, September 5, 2017

Sending Dynamics fields to Docusign with D365, Using Merge fields in Docusign



Send Dynamics fields to DocuSign from D365 -  Merge fields in DocuSign

DocuSign, one of the leading solution to the e-signature platform that is available as a standard product with ready-made integration to Dynamics CRM/365. This post's objective is to explore how to send the document by pulling the dynamics fields from CRM to DocuSign template. By doing this the fields like Name, address, ID, dates can be pulled dynamically from the DocuSign

Example Use cases 
- While sending opportunities/orders for sign-off (using DocuSign) add Client Name, Address, Account Number, price/details about the order automatically to the template before sending it for sign off
- While sending contracts with details about the customer (eg., name, address etc) the customer fields can be added dynamically from CRM record


Scenario
For this blog let us consider a scenario where a contract is required to signed-off by the customer before an opportunity is closed

Step 1 - Opportunity record is created and customer record is associated to the opportunity record
Step 2 - Open the opportunity record and select the template to be sent for e-signature
Step 3 - From opportunity record, select more buttons and click on "Send with DocuSign" button
Step 4 - System logs into DocuSign and opens the selected template
Step 5 - User verifies the document and clicks on "Send for Esignature"

These are the steps that would have to be performed by the user to send a dynamic template to the customer for signature. The below sections will tell us the steps to "Configure" this functionality. I have seen lot of customers who have heavily customized to achieve this functionality but this blog will help you understand how this whole functionality can be developed without programming.

Pre-requisite - DocuSign add-on has to be installed in the CRM application

Step 1 -Create a custom entity for DocuSign Template, This will be used to select a template required for the Opportunity which is to be sent.
Step 2 – Import a template and Creating Merge Fields in DocuSign Template
Step 3 - Create CRM Action and add merge fields
Step 4 – Assign the Action in DocuSign settings to the Opportunity Record

Step 1 Create an Entity for Tracking DocuSign Template

This is an optional step. Let us assume there are multiple templates available within the organization and the template will have to sent according to the customer’s language or product. This entity lookup (when placed on Opportunity entity) will send the envelope id dynamically to the DocuSign which will enable that particular envelope to be opened. Optionally if there is only one envelope id, that can be hardcoded in the workflow.
Create the entity with the following fields
a)       Template Name
b)      Envelope ID
This entity will need to be placed on the opportunity entity as a lookup where the user can use it to select the Envelope that is to be sent to the customer

Step 2  Import a template and Create Merge Fields in DocuSign Template


Let us assume that the below template is to be added and all the fonts in the red are to be added as dynamic fields from Dynamics CRM


                     I.            Login to CRM and navigate to Settings> DocuSign>> DocuSign Admin
                   II.            From the resulting page click on the “GO TO DOCUSIGN”  button and this opens the DocuSign Admin Page
                 III.            Navigate to Templates>Click on New Button to create a new Envelope/Template

                IV.            Upload the template to the “Add Documents to the Envelope” Section
                  V.            Now in the “Add recipients to the Envelope” Section> Under Role field> Enter the “role name” (remember this name we will use this in Process Action), in our case we are using ‘sales’ as the role name and Click “Next”
                VI.            The template which was uploaded will be opened in an iFrame with options to drag and drop fields from left navigation pane
               VII.            We need to Create the below fields to be added in the template
a.       Full Name
b.       First Name
c.       Opportunity Title
d.       Owner
e.       Address



             VIII.            Create all Custom Field as shown below. Once created it will be available to drag and drop from the left navigation pane

                 IX.            Drag and drop all the custom fields that were created by you on the template where ever necessary
                                                                           i.      Note down the DataLabel for each of the fields that you have dragged, These values have to be referred in the Process Action which will be create shortly. In the below screen for Full Name field the Data label is “fullname”. Similarly capture the Data Label for other custom fields that have been created for the template


                   X.            Copy Envelope ID – once the template is created open the template and copy the template id. We will need this in our Process Action. Use this template ID in the custom entity record created in step 1

Step 3 Creation of Microsoft Dynamics Process Action

The next step is to create a process Action in Microsoft Dynamics CRM which will bind these custom attributes created in DocuSign to CRM attributes and push the dynamic values to the Template.
                     I.            Dynamics CRM>> Settings>Process>Click on New Process> Select Type as ‘Action’> Select Entity “Opportunity” or any other entity where the process has to be triggered
                   II.            In the resulting process page, Enter process Argument
a.       Name EnvelopeURL
b.       Type – String
c.       Direction – Output
d.       Required- checked


Action Step 1 – Create Envelope

a)       Next step is to Add process Steps – Create Envelope Step
b)      Add Step>>DocuSign Integration>>DocuSign.DSIntegrationActivity.CreateEnvelope


aca) Create Envelope step is added as below
b)      Click on Set Properties
c)       In the resulting window add TemplateId. This can be a static envelope id if the requirement is to send only one template id or use the Form Assistant to bring in our envelope Id from the custom entity created in step 1 (DocuSign Template)

d)      Save and Close


Action Step 2 – Add Document (this step is needed if you a document from notes>attachment needs to be sent to DocuSign for esignature)

a)       Next step is to Add process Steps – Add Document Step
a.       Add Step>>DocuSign Integration>>DocuSign.DSIntegrationActivity.AddDocument
b)      Create Envelope step is added as below
c)       Click on Set Properties
d)      In the resulting window add Envelope from form assistant as shown below (From Assistant>Local Values>Create Envelope> Envelope)
e)      Save and Close



Action Step 3 – Add Recipient

a)       Next step is to Add process Steps – Add Document Step
a.       Add Step>>DocuSign Integration>>DocuSign.DSIntegrationActivity.AddRecipient
b)      Add Recipient step is added as below
c)       Click on Set Properties
d)      In the resulting window add Envelope from form assistant as shown below (From Assistant>Local Values>Create Envelope> Envelope)
e)      Name – Add the name of the recipient (Dynamically pull it from Opportunity)
f)        Email – The email address of the recipient (In this case Opportunity’s Contact)
g)       Role – The role we defined in the recipient “Sales” in step 2 Template creation – This role will map the above email, name etc. to the recipient in the DocuSign Template defined in step 2


Action Step 4 – Add Merge Fields

a)       This is the main step where we associate the custom DocuSign fields with the CRM attributes
a.        Add Step>>DocuSign Integration>>DocuSign.DSIntegrationActivity.AddRecipient
b)      Add Merge step is added as below
c)       Click on Set Properties
d)      In the resulting window add Envelope from form assistant as shown below (From Assistant>Local Values>Create Envelope> Envelope)
e)      Add Recipient ID from form assistant as shown below (From Assistant>Local Values>  Add and Map Recipient> RecipientId)
f)        Tag Label – Enter the Custom field, Data Label value which we created in Custom field creation in step 3 (while creating Templates). For example, for the Full Name field we created the docusign custom field with datalabel ‘fullname’
g)       Value – This is the field from Dynamics, Use the form assistant to pull Full name of the opportunity
h)      Similarly create merge field step for all the custom fields (in our example, First Name, Opportunity Topic, Owner, Address, etc.)


Action Step 5 – Get Signature

a)       Next step is to Add process Steps – Add Document Step
a.       Add Step>>DocuSign Integration>>DocuSign.DSIntegrationActivity.Get.Signature
b)      Add Recipient step is added as below
c)       Click on Set Properties
d)      In the resulting window add Envelope from form assistant as shown below (From Assistant>Local Values>Create Envelope> Envelope)
e)      One Click Send – False
f)        One Click Options – prepare







Action Step 6– Envelope URL

a)       Click on Add Step and Add “Assign Value”
b)      Assign Value is added as below
c)       Click on Set Properties
d)      Add Statement Label as “Envelope URL”
e)      Name: auto populates
f)        Value – use the form assistant to pull Get Signature Step>Envelope URL

Step Save and Activate the Action


Step 4 Assign This action to the Opportunity Entity

1)      CRM>Settings>DocuSign Admin> Entities> Navigate to Opportunity and Select the Action you created in “Send with DocuSign” Column


Output/Results


Navigate to Opportunity>Navigation toolbar>> Send with DocuSign
DocuSign window opens up with the template

1)      The selected template automatically opens up
2)      Contact name and email address is dynamically pulled from Add.Recipeint Step (role=sales)
Click on Next


All the fields populated dynamically from CRM to DocuSign. This document can be sent to the recipient for signing.




1 comment:

Bilal Ahmed said...

I cannot see option to select Action on Step 4 in new Docu sign. something has changed ?