I am trying to use this example from https://apirequestbuilder.docusign.com. As can be seen in this example, the signer 1 is not assigned any tabs (text1, text2).. All tabs (fields, checkbox etc) are assigned only to Signer2. Yet both Signer1 and Signer2 are able to see the data (values of text1 and text2 tabs) when the envelope is sent for signing. why is this happening?
// DocuSign Builder example. Generated: Fri, 20 Sep 2024 21:06:56 GMT
// DocuSign (c) 2024. MIT License -- https://opensource.org/licenses/MIT
// @see https://developers.docusign.com -- DocuSign Developer Center
using System.Collections.Generic;
using System.IO;
using System;
using DocuSign.eSign.Api;
using DocuSign.eSign.Client;
using DocuSign.eSign.Model;
namespace CSharp_example
{
class Program
{
// Note: the accessToken is for testing and is temporary. It is only good for 8 hours from the time you
// authenticated with API Request Builder. In production, use an OAuth flow to obtain access tokens.
private const string accessToken = "";
private const string accountId = "";
private const string basePath = "https://demo.docusign.net/restapi";
// Create the envelope request and send it to DocuSign
// Returns the resulting envelopeId or ""
static string SendDocuSignEnvelope()
{
ServerTemplate serverTemplate1 = new ServerTemplate
{
Sequence = "1",
TemplateId = ""
};
List<ServerTemplate> serverTemplates1 = new List<ServerTemplate> {serverTemplate1};
Signer signer1 = new Signer
{
Email = null,
Name = null,
RecipientId = "2",
RoleName = "signer2"
};
Text textTab1 = new Text
{
FontColor = "DarkGreen",
Locked = "false",
TabLabel = "text1",
Value = "Initial value set by the API call"
};
Text textTab2 = new Text
{
Bold = "true",
FontColor = "DarkGreen",
Locked = "true",
TabLabel = "text2",
Value = "● Set via API call
● Multiline text tabs too!
● This could be additional information specific to the recipient or contract.
"
};
Text textTab3 = new Text
{
FontColor = "DarkGreen",
Locked = "true",
TabLabel = "cklabel1",
Value = "Set via the API call"
};
Text textTab4 = new Text
{
FontColor = "Purple",
Locked = "true",
TabLabel = "cklabel2",
Value = "label for checkbox2"
};
List<Text> textTabs1 = new List<Text> {textTab1, textTab2, textTab3, textTab4};
Checkbox checkboxTab1 = new Checkbox
{
Selected = "true",
TabLabel = "checkbox1"
};
Checkbox checkboxTab2 = new Checkbox
{
Selected = "true",
TabLabel = "checkbox2"
};
List<Checkbox> checkboxTabs1 = new List<Checkbox> {checkboxTab1, checkboxTab2};
ListItem listItem1 = new ListItem
{
Selected = "false",
Text = "option 1",
Value = "option 1"
};
ListItem listItem2 = new ListItem
{
Selected = "true",
Text = "option 2",
Value = "option 2"
};
ListItem listItem3 = new ListItem
{
Selected = "false",
Text = "option 3",
Value = "option 3"
};
List<ListItem> listItems1 = new List<ListItem> {listItem1, listItem2, listItem3};
List listTab1 = new List
{
FontColor = "NavyBlue",
ListItems = listItems1,
TabLabel = "dropdown1"
};
List<List> listTabs1 = new List<List> {listTab1};
Tabs tabs1 = new Tabs
{
CheckboxTabs = checkboxTabs1,
ListTabs = listTabs1,
TextTabs = textTabs1
};
Signer signer2 = new Signer
{
Email = null,
Name = null,
RecipientId = "1",
RoleName = "signer1",
Tabs = tabs1
};
List<Signer> signers1 = new List<Signer> {signer1, signer2};
Recipients recipients1 = new Recipients
{
Signers = signers1
};
InlineTemplate inlineTemplate1 = new InlineTemplate
{
Recipients = recipients1,
Sequence = "2"
};
List<InlineTemplate> inlineTemplates1 = new List<InlineTemplate> {inlineTemplate1};
CompositeTemplate compositeTemplate1 = new CompositeTemplate
{
InlineTemplates = inlineTemplates1,
ServerTemplates = serverTemplates1
};
List<CompositeTemplate> compositeTemplates1 = new List<CompositeTemplate> {compositeTemplate1};
EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
{
CompositeTemplates = compositeTemplates1,
Status = "sent"
};
ApiClient apiClient = new ApiClient(basePath);
apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
try
{
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);
Console.WriteLine($"Envelope status: {results.Status}. Envelope ID: {results.EnvelopeId}");
return results.EnvelopeId;
}
catch (ApiException e)
{
Console.WriteLine("Exception while creating envelope!");
Console.WriteLine($"Code: {e.ErrorCode}\nContent: {e.ErrorContent}");
//Console.WriteLine(e.Message);
return "";
}
}
// Request the URL for the recipient view (Signing Ceremony)
static void RecipientView(string envelopeId)
{
bool doRecipientView = false;
RecipientViewRequest recipientViewRequest = null;
if (!doRecipientView || envelopeId == "")
{
return; // EARLY return
}
ApiClient apiClient = new ApiClient(basePath);
apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
try
{
ViewUrl results = envelopesApi.CreateRecipientView(accountId, envelopeId, recipientViewRequest);
Console.WriteLine("Create recipient view succeeded.");
Console.WriteLine("Open the signing ceremony's long URL within 5 minutes:");
Console.WriteLine(results.Url);
}
catch (ApiException e)
{
Console.WriteLine("Exception while requesting recipient view!");
Console.WriteLine($"Code: {e.ErrorCode}\nContent: {e.ErrorContent}");
//Console.WriteLine(e.Message);
}
}
/// <summary>
/// This method read bytes content from files in the project's Resources directory
/// </summary>
/// <param name="fileName">resource path</param>
/// <returns>return Base64 encoded content as string</returns>
internal static string ReadContent(string fileName)
{
byte)] buff = null;
string path = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\Resources", fileName);
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
using (BinaryReader br = new BinaryReader(stream))
{
long numBytes = new FileInfo(path).Length;
buff = br.ReadBytes((int)numBytes);
}
}
return Convert.ToBase64String(buff);
}
// The mainline
static void Main(string] args)
{
Console.WriteLine("Starting...");
string envelopeId = SendDocuSignEnvelope();
RecipientView(envelopeId);
Console.WriteLine("Done.");
}
}
}