I am trying to integrate my website with Docusign via embedded signing using inperson signer . My .Net website logs in and opens the docusign template and I should be able to pass values via rest api to the tags on the docusign document.But the tag values I pass via Rest api to the tags "Full name" and "Company" are not getting populated. The rolename name for the template is "Signer1" and use "Sign in person" as action.Check this path for the screenshot for rolename

Also it is showing as free form signing. There are "FIELDS" to the left of my document and I need to drag and drop these on the form ( I have populated these fields with values).

But I dont want to see the left side free form fields. I just want to pass the tags value to the document for the inperson signer and it should be displayed in the document.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.IO;
using System.Net;
using System.Xml;
using System.Text;
using RestSharp;
using Newtonsoft.Json;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using log4net;
using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client;

namespace TestProject
{
    public partial class Home : System.Web.UI.Page
    {
        protected void getDocusign()
        {
            string username = "****";
            string password = "****";
            string integratorKey = "****************************";
            string templateId = "*******************************";        
            string roleName = "Signer1"; 



            string url = "https://demo.docusign.net/restapi/v2/login_information";
            string baseURL = "";    // we will retrieve this
            string accountId = "";  // will retrieve
            string envelopeId = ""; // will retrieve
            string uri = "";    // will retrieve
            try
            {
                string authenticateStr =
                    "<DocuSignCredentials>" +
                        "<Username>" + username + "</Username>" +
                        "<Password>" + password + "</Password>" +
                        "<IntegratorKey>" + integratorKey + "</IntegratorKey>" +
                        "</DocuSignCredentials>";
                // 
                // STEP 1 - Login
                //
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
                request.Accept = "application/xml";
                request.Method = "GET";
                HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();
                StreamReader sr = new StreamReader(webResponse.GetResponseStream());
                string responseText = sr.ReadToEnd();
                using (XmlReader reader = XmlReader.Create(new StringReader(responseText)))
                {
                    while (reader.Read())
                    { // Parse the xml response body
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "accountId"))
                            accountId = reader.ReadString();
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "baseUrl"))
                            baseURL = reader.ReadString();
                    }
                }
                //
                // STEP 2 - Request Envelope Result
                //
                // Construct an outgoing XML request body
                string requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
                    "<accountId>" + accountId + "</accountId>" +
                        "<status>sent</status>" +
                        "<emailSubject>Company Notice - Signature Request</emailSubject>" +
                        "<emailBlurb>Testing from Sandy</emailBlurb>" +
                        "<templateId>" + templateId + "</templateId>" +
                        "<templateRoles>" +
                        "<templateRole>" +
                        "<email>" + "[email protected]" + "</email>" + // NOTE: Use different email address if username provided in non-email format!
                        "<name>" + "George Keane" + "</name>" +               // username can be in email format or an actual ID string
                        "<roleName>" + roleName + "</roleName>" +
                        "<clientUserId>9</clientUserId>" +
                        "<tabs>" +
                        "<textTabs>" +
                        "<text>" +
                        "<tabLabel>" + "Full Name" + "</tabLabel>" +
                        "<value>" + "George Keane" + " </value>" +
                        "</text>" +
                         "<text>" +
                        "<tabLabel>" + "Company" + "</tabLabel>" +
                        "<value>" + "Dell" + " </value>" +
                        "</text>" +
                        "</textTabs>" +
                        "</tabs>" +
                        "</templateRole>" +
                        "</templateRoles>" +
                        "</envelopeDefinition>";

                // append "/envelopes" to baseUrl and use in the request
                request = (HttpWebRequest)WebRequest.Create(baseURL + "/envelopes");
                request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
                request.ContentType = "application/xml";
                request.Accept = "application/xml";
                request.ContentLength = requestBody.Length;
                request.Method = "POST";
                // write the body of the request
                byte[] body = System.Text.Encoding.UTF8.GetBytes(requestBody);
                Stream dataStream = request.GetRequestStream();
                dataStream.Write(body, 0, requestBody.Length);
                dataStream.Close();
                // read the response
                webResponse = (HttpWebResponse)request.GetResponse();
                sr = new StreamReader(webResponse.GetResponseStream());
                responseText = sr.ReadToEnd();
                using (XmlReader reader = XmlReader.Create(new StringReader(responseText)))
                {
                    while (reader.Read())
                    { // Parse the xml response body
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "envelopeId"))
                            envelopeId = reader.ReadString();
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "uri"))
                            uri = reader.ReadString();
                    }
                }
                //
                // STEP 3 - Get the Embedded Console Sign View
                //
                // construct another outgoing XML request body
                string reqBody = "<recipientViewRequest xmlns=\"http://www.docusign.com/restapi\">" +
                    "<authenticationMethod>email</authenticationMethod>" +
                        "<email>" + "[email protected]" + "</email>" +  //+ username +   // NOTE: Use different email address if username provided in non-email format!
                        "<returnUrl>http://www.docusign.com</returnUrl>" +  // username can be in email format or an actual ID string
                        "<clientUserId>9</clientUserId>" +
                        "<userName>" + "George Keane" + "</userName>" +
                        "</recipientViewRequest>";

                // append uri + "/views/recipient" to baseUrl and use in the request
                request = (HttpWebRequest)WebRequest.Create(baseURL + uri + "/views/recipient");
                request.Headers.Add("X-DocuSign-Authentication", authenticateStr);
                request.ContentType = "application/xml";
                request.Accept = "application/xml";
                request.ContentLength = reqBody.Length;
                request.Method = "POST";
                // write the body of the request
                byte[] body2 = System.Text.Encoding.UTF8.GetBytes(reqBody);
                Stream dataStream2 = request.GetRequestStream();
                dataStream2.Write(body2, 0, reqBody.Length);
                dataStream2.Close();
                // read the response
                webResponse = (HttpWebResponse)request.GetResponse();
                sr = new StreamReader(webResponse.GetResponseStream());
                responseText = sr.ReadToEnd();
                using (XmlReader reader = XmlReader.Create(new StringReader(responseText)))
                {
                    while (reader.Read())
                    { // Parse the xml response body
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "url"))
                            url = reader.ReadString();
                    }
                }
                Console.WriteLine("Embeded View Result --> " + responseText);
                System.Diagnostics.Process.Start(url);
            }
            catch (WebException e)
            {
                using (WebResponse response = e.Response)
                {
                    HttpWebResponse httpResponse = (HttpWebResponse)response;
                    Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
                    using (Stream data = response.GetResponseStream())
                    {
                        string text = new StreamReader(data).ReadToEnd();
                        Console.WriteLine(text);
                    }
                }
            }

        }

    }
}



 [enter image description here][1]


  [1]: https://i.stack.imgur.com/iGx0U.jpg
1

There are 1 best solutions below

0
On

The FullName and Company tabs are "standard" tab types and not "custom" tab types. You can view their true nature by looking at the schema or WSDL. The concepts still apply, even when using REST. The distinction is that the "standard" tab types (signHere, initialHere, dateSigned, etc.) are derived from the recipient information and populated at time of signing, while the "custom" tab types are recipient input tabs (text, list, checkbox, etc.). You can only pre-populate or pre-set "standard" tab type values (exceptions are for recipient info that is optional and may not have values, such as a DS member's title or company).

Therefore, fullName will be populated based on the full name provided by the signer at the time of signature adoption. The company tab will be populated if the signer has a membership in a DocuSign account. Otherwise, you should be able to pre-populate it (similar case for title tabs and others that rely on a member's optional data).

Since in your particular case you are specifying a Captive Recipient, they will not match up to any DS members so you should be able to pre-populate the company tab. But you need to do this in the correct tab type XML element, i.e. within <companyTabs>.