Updated: Generating Envelope with eNotary Signature, Seal, DateSigned TABS thru eSign api - docusignapi

In our organization dmz web application, On behalf of Signer(our client) we generate envelopes and send it to notary. And we are trying to utilize the Signature, Seal, DateSigned TABS in eNotary (InPersonSigner Receipient) envelope thru eSign API in sandbox environment. But docusignapi is not allowing us to create Signature, Seal, DateSigned TABS, but it allows only Notarize TAB.
How we can utilize the Signature, Seal, DateSigned TABS for Notary thru eSign API?
Updated Code throws attached error "Notary_Signing_Host_Tabs_Not_Allowed":
string signerEmail = "signer#domain.com";
string signerName = "Signer";
string notaryEmail = "notary#domain.com";
string notaryName = "Notary";
// Step 1. Create the envelope definition
EnvelopeDefinition envelope = new EnvelopeDefinition();
envelope.EmailSubject = "Please sign this document";
byte[] buffer = System.IO.File.ReadAllBytes("Execute_and_Notarize.pdf");
Document doc1 = new Document();
String doc1b64 = Convert.ToBase64String(buffer);
doc1.DocumentBase64 = doc1b64;
doc1.Name = "Notarize1_1page"; // can be different from actual file name
doc1.FileExtension = "pdf";
doc1.DocumentId = "1";
// The order in the docs array determines the order in the envelope
envelope.Documents = new List<Document> { doc1 };
Notarize notarize1 = new Notarize
{
AnchorString = "/notary1/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10",
Required = "true"
};
SignHere notarizesignhere1 = new SignHere
{
AnchorString = "/notarysigner1/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10"
};
SignHere notarizesignhere2 = new SignHere
{
AnchorString = "/notarysignerseal1/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10",
IsSealSignTab = "true"
};
DateSigned notarizedatesigned1 = new DateSigned()
{
AnchorString = "/notarysigner1ds/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10"
};
Tabs notaryTabs = new Tabs
{
NotarizeTabs = new List<Notarize> { notarize1 },
SignHereTabs = new List<SignHere> { notarizesignhere1, notarizesignhere2 },
DateSignedTabs = new List<DateSigned> { notarizedatesigned1 }
};
NotaryHost notaryHost = new NotaryHost()
{
Email = notaryEmail,
Name = notaryName,
DeliveryMethod = "email",
RecipientId = "2",
Tabs = notaryTabs
};
// Create signHere fields (also known as tabs) on the documents,
// We're using anchor (autoPlace) positioning
//
// The DocuSign platform seaches throughout your envelope's
// documents for matching anchor strings.
SignHere signHere1 = new SignHere
{
AnchorString = "/signer1/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10"
};
DateSigned dateSigned1 = new DateSigned()
{
AnchorString = "/signer1ds/",
AnchorUnits = "pixels",
AnchorXOffset = "10",
AnchorYOffset = "10"
};
// Tabs are set per recipient / signer
Tabs signer1Tabs = new Tabs
{
SignHereTabs = new List<SignHere> { signHere1 },
DateSignedTabs = new List<DateSigned> { dateSigned1 }
};
// Create a signer recipient to sign the document, identified by name and email
// We set the clientUserId to enable embedded signing for the recipient
// We're setting the parameters via the object creation
InPersonSigner inPersonSigner1 = new InPersonSigner()
{
Email = signerEmail,
Name = signerName,
RecipientId = "1",
InPersonSigningType = "notary",
Tabs = signer1Tabs
};
inPersonSigner1.NotaryHost = notaryHost;
// Add the recipient to the envelope object
Recipients recipients = new Recipients
{
InPersonSigners = new List<InPersonSigner> { inPersonSigner1 },
};
envelope.Recipients = recipients;
Image Attachment: errorCode - notary_signing_host_tabs_not_allowed

You are missing one line at least:
inPersonSigner1.NotaryHost = notaryHost;
Here is a C# snippet taken from my blog post on the subject:
// To complete this code snippet, you will need an Envelope and a Document object
var notarizeTab = new Notarize
{
XPosition = "100",
YPosition = "100"
};
var signHereTab = new SignHere
{
XPosition = "200",
YPosition = "200"
};
var notarizeTabs = new List<Notarize>();
notarizeTabs.Add(notarizeTab);
var signHereTabs = new List<SignHere>();
signHereTabs.Add(signHereTab);
var notaryHost = new NotaryHost
{
Name = "Nadia Notary",
Email = "nadianotary#domain.com",
DeliveryMethod = "email",
RecipientId = "2",
Tabs = new Tabs { NotarizeTabs = notarizeTabs }
};
// InPersonSigner is used here even if the signer doesn't sign in person
var inPersonSigner = new InPersonSigner
{
NotaryHost = notaryHost,
Name = "Eddie End User",
Email = "endusersigner#domain.com",
RecipientId = "1",
InPersonSigningType = "notary",
Tabs = new Tabs { SignHereTabs = signHereTabs }
};
var inPersonSigners = new List<InPersonSigner>();
inPersonSigners.Add(inPersonSigner);
var recipients = new Recipients{ InPersonSigners = inPersonSigners };
You can add whatever tabs you need, but the important thing is to understand that the notary is a different recipient and they have their own separate tabs.

Related

Implementing sign a document option without send notification email to signer

I am trying to implement sign a document option in my application.
It is working perfectly but during the process it sends email to signer to review document (which doesn't happen when created via DocuSign UI). How I can stop this review document email from sending to signer.
Here what I am doing in my code
Creating envelope
try
{
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = selectedFileList[0].subject;
envDef.Documents = new List<Document>();
foreach (var file in selectedFileList)
{
envDef.Documents.Add(getDocument(file.localPath, file.fullFileName, file.extension, file.number.ToString(), file.version.ToString(), file.databaseName));
}
Signer signer = new Signer();
signer.Email = signerEmail;
signer.Name = signerName;
signer.RecipientId = "1";
envDef.Recipients = new Recipients();
envDef.Recipients.Signers = new List<Signer>();
envDef.Recipients.Signers.Add(signer);
envDef.Status = "sent";
EnvelopesApi envelopesApi = new EnvelopesApi(config);
var response = await Task.Run(() => { return envelopesApi.CreateEnvelopeWithHttpInfo(accountId, envDef); });
EnvelopeSummary envelopeSummary = response.Data;
responseHeaders = response.Headers;
}
catch (Exception ex)
{
throw ex;
}
Creating receipent view
EnvelopesApi envelopesApi = new EnvelopesApi(apiConfig);
RecipientViewRequest viewRequest = new RecipientViewRequest();
viewRequest.UserName = signerName;
viewRequest.Email = signerEmail;
viewRequest.RecipientId = "1";
viewRequest.AuthenticationMethod = "email";
viewRequest.ReturnUrl = returnUrl;
//viewRequest.ClientUserId = apiConfig;
var view = envelopesApi.CreateRecipientView(accountId, envelopeId, viewRequest);
var url = view.Url;
Try to add this code in your app:
var textCustomFields = new List<TextCustomField>();
var textCustomField = new TextCustomField { Name = "AppName", Value = "DocuSignIt" };
textCustomFields.Add(textCustomField);
envDef.CustomFields.TextCustomFields = textCustomFields;
This should tell DocuSign not to send the email.
Setting the ClientUserId attribute value for a recipient also marks the recipient to not receive the email invitation to sign.
Setting ClientUserId is the recommended approach for embedded signing.
The value of the ClientUserId attribute also acts as a connection between the authentication that your application has done and the signing ceremony which enables the person to sign the documents.

Populate Dropdown options using c# code in a docusign template before creating envelope

I have create a template in my Admin Account Panel, and I am using the template to create new envelopes and send to different receivers.
But in my template I have a dropdown whose value changes on some condition,
like for State A it will have different values, for State B it will have different values.
How do I handle it programmatically.
Here is how I create an envelope from a template.
string recipientEmail = "a#a.com";
string recipientName = "John Doe";
string templateRoleName = "Customer";
string TemplateId = "xxxxxxxx-c87454e95429";
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
// assign recipient to template role by setting name, email, and role name. Note that the
// template role name must match the placeholder role name saved in your account template.
TemplateRole tRole = new TemplateRole();
tRole.Email = recipientEmail;
tRole.Name = recipientName;
tRole.RoleName = templateRoleName;
List<TemplateRole> rolesList = new List<TemplateRole>() { tRole };
// add the role to the envelope and assign valid templateId from your account
envDef.TemplateRoles = rolesList;
envDef.TemplateId = TemplateId;
// set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent";
// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi(cfi);
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);
To populate tabs in a template you must match the name of the tab using the tabLabel property and set its value to the data you want to populate it with
Documentation here
string recipientEmail = "a#a.com";
string recipientName = "John Doe";
string templateRoleName = "Customer";
string TemplateId = "xxxxxxxx-c87454e95429";
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
// assign recipient to template role by setting name, email, and role name. Note that the
// template role name must match the placeholder role name saved in your account template.
var tRole = new TemplateRole();
tRole.Email = recipientEmail;
tRole.Name = recipientName;
tRole.RoleName = templateRoleName;
var dropdownItems = new List<ListItem>();
if (stateA)
{
dropdownItems.Add(new ListItem()
{
Text = "Yellow", Value = "Y", Selected = "true"
});
dropdownItems.Add(new ListItem()
{
Text = "Green",Value = "G"
});
}
else
{
dropdownItems.Add(new ListItem()
{
Text = "Red", Value = "R", Selected = "true"
});
dropdownItems.Add(new ListItem()
{
Text = "Blue", Value = "B"
});
dropdownItems.Add(new ListItem()
{
Text = "Orange", Value = "O"
});
}
tRole.Tabs = new Tabs()
{
ListTabs = new List<List>()
{
new List(){
TabLabel = "ColorDropdown",
ListItems = dropdownItems
}
}
};
var rolesList = new List<TemplateRole>() { tRole };
// add the role to the envelope and assign valid templateId from your account
envDef.TemplateRoles = rolesList;
envDef.TemplateId = TemplateId;
// set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent";
// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);

DocuSign Rest API: Signer can sign a tab which is for a different recipient

I am trying to create a simple scenario with the DocuSign REST API as follows:
I have 2 signers, Signer1 and Signer2
A document is sent to Signer1 to review and sign
Signer 2 is notified and reviews the document and signs below where Signer1 signed
I have this working in order except that when Signer1 reviews the document they see Signer2's tab and have to sign for Signer2 as well. The tabs in the document have different names and I am adding the relevant AnchorStrings to the event notification.
Here is my code:
Signer signer = new Signer();
signer.Email = txtRecipientEmail;
signer.Name = txtRecipientName;
signer.RecipientId = "1";
signer.RoleName = "Candidate";
signer.RoutingOrder = "1";
// Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = new Tabs();
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.DocumentId = "1";
signHere.AnchorString = "PleaseSignHere";
signHere.AnchorXOffset = "-2";
signHere.AnchorYOffset = "0";
signHere.AnchorIgnoreIfNotPresent = "false";
signHere.AnchorUnits = "inches";
signer.Tabs.SignHereTabs.Add(signHere);
signer.Tabs.DateSignedTabs = new List<DateSigned>();
DateSigned dateSigned = new DateSigned();
dateSigned.DocumentId = "1";
dateSigned.AnchorString = "DateSignedHere";
dateSigned.AnchorXOffset = "0";
dateSigned.AnchorYOffset = "0";
dateSigned.AnchorIgnoreIfNotPresent = "false";
dateSigned.AnchorUnits = "inches";
dateSigned.Bold = "true";
signer.Tabs.DateSignedTabs.Add(dateSigned);
// add another signer
Signer signer2 = new Signer();
signer2.Email = txtRecipientEmail2;
signer2.Name = txtRecipientName2;
signer2.RecipientId = "2";
signer2.RoleName = "Referee";
signer2.RoutingOrder = "2";
signer2.Tabs = new Tabs();
signer2.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere2 = new SignHere();
signHere2.DocumentId = "1";
signHere2.AnchorString = "RefPleaseSignHere";
signHere2.AnchorXOffset = "-2";
signHere2.AnchorYOffset = "0";
signHere2.AnchorIgnoreIfNotPresent = "false";
signHere2.AnchorUnits = "inches";
signer2.Tabs.SignHereTabs.Add(signHere2);
signer2.Tabs.DateSignedTabs = new List<DateSigned>();
DateSigned dateSigned2 = new DateSigned();
dateSigned2.DocumentId = "1";
dateSigned2.AnchorString = "RefDateSignedHere";
dateSigned2.AnchorXOffset = "0";
dateSigned2.AnchorYOffset = "0";
dateSigned2.AnchorIgnoreIfNotPresent = "false";
dateSigned2.AnchorUnits = "inches";
dateSigned2.Bold = "true";
signer2.Tabs.DateSignedTabs.Add(dateSigned2);
envDef.Recipients = new Recipients();
envDef.Recipients.Signers = new List<Signer>();
envDef.Recipients.Signers.Add(signer);
envDef.Recipients.Signers.Add(signer2);
I must be missing something!
The anchorString for Signer1 is also present in anchorString for Signer2.
PleaseSignHere
RefPleaseSignHere
This is causing Signer1 tabs to be additionally placed at Signer2 tab location.
Solution
Set the AnchorMatchWholeWord property to true.
or
Use unique anchorStrings which do not overlap.

Docusign ViewUrl: UNKNOWN_ENVELOPE_RECIPIENT error

I'm trying out a simple example to get a pdf signed in docuSign, but I'm running into the UNKNOWN_ENVELOPE_RECIPIENT error when trying to get the ViewUrl to redirect the user.
Here is the code I'm using to to create the envelope with the pdf doc.
string recipientName = "Tester";
string recipientEmail = "test#me.com";
string accountId = AuthenticateDocuSign();
byte[] fileBytes = File.ReadAllBytes(#"C:\temp\test.pdf");
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
// Add a document to the envelope
DocuSign.eSign.Model.Document doc = new DocuSign.eSign.Model.Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = "TestFile.pdf";
doc.DocumentId = "1";
envDef.Documents = new List<DocuSign.eSign.Model.Document>();
envDef.Documents.Add(doc);
// Add a recipient to sign the documeent
Signer signer = new Signer();
signer.Email = recipientEmail;
signer.Name = recipientName;
signer.RecipientId = "1";
// Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = new Tabs();
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.DocumentId = "1";
signHere.PageNumber = "1";
signHere.RecipientId = "1";
signHere.XPosition = "100";
signHere.YPosition = "100";
signer.Tabs.SignHereTabs.Add(signHere);
envDef.Recipients = new Recipients();
envDef.Recipients.Signers = new List<Signer>();
envDef.Recipients.Signers.Add(signer);
// set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent";
// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
RecipientViewRequest viewOptions = new RecipientViewRequest()
{
ReturnUrl = returnURL,
ClientUserId = "1000", // must match clientUserId set in step #2!
AuthenticationMethod = "email",
UserName = recipientName,
Email = recipientEmail,
};
ViewUrl recipientView = envelopesApi.CreateRecipientView(accountId, envelopeSummary.EnvelopeId, viewOptions); // EXCEPTION!
Complete error:
DocuSign.eSign.Client.ApiException was unhandled by user code
ErrorCode=400 HResult=-2146233088 Message=Error calling
CreateRecipientView: { "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient
of the specified envelope." }
As Luis indicates in the comment above, you must specify the clientUserId property for the signer in the Create Envelope request, if you want to be able to subsequently retrieve the "View" URL for that Recipient:
signer.clientUserId = 1000;
You can set the clientUserId property to any value you choose -- I used 1000 in this example because that's the value that your code is using in the Post Recipient View request.
ClientUserId = "1000", // must match clientUserId set in step #2!
(The clientUserId, name, and email property values that you specify in the Post Recipient View request must exactly match the values that you specified for the Recipient in the Create Envelope request.)

GetRecipientView: REST API Error ACCOUNT_NOT_AUTHORIZED_FOR_ENVELOPE

I am trying to get recipient url but getting "GetRecipientView REST Error ACCOUNT_NOT_AUTHORIZED_FOR_ENVELOPE #44".
First I am creating the envelope to get sender url. And then I calling GetRecipientView() to get recipient view url. Below is the code I am using
public string EmbeddedSenderView(string docId)
{
Account account = InitializeDocSign();
Envelope envelope = new Envelope();
envelope.Login = account;
envelope.EmailSubject = "Please sign document";
envelope.Recipients = new Recipients()
{
signers = new Signer[]
{
new Signer()
{
email = "xxxx#gmail.com",
name = "AV Gmail 1",
routingOrder = "1",
recipientId = "1",
roleName="Signer",
clientUserId="101"
},
},
};
envelope.Create("\FAQ_NMS.pdf");
bool result = envelope.GetSenderView("my domain");
/*Saving document details into Database*/
if (result)
{
ObjDocumentSignRequest obj = new ObjDocumentSignRequest();
obj.DocumentId = docId;
obj.EnvelopeId = envelope.EnvelopeId;
obj.SenderViewUrl = envelope.SenderViewUrl;
eSignUtilities.SaveSignRequest(obj);
}
return envelope.SenderViewUrl;
}
public void EmbeddedRecepientView(string docId)
{
Account account = InitializeDocSign();
Envelope envelope = new Envelope();
envelope.Login = account;
envelope.EmailSubject = "Please sign document";
envelope.Recipients = new Recipients()
{
signers = new Signer[]
{
new Signer()
{
email = "xxxx#gmail.com",
name = "AV Gmail 1",
routingOrder = "1",
recipientId = "1",
roleName="Signer",
clientUserId="101"
},
},
};
envelope.EnvelopeId = "xxxxxxxxxxx";
envelope.UpdateStatus();
bool result = envelope.GetRecipientView("my domain");
Any help?
Thanks
AV
You need to send the envelope before you can request the signing URL (aka recipient view). It looks like you are creating the envelope, generating the embedded sending URL, then trying to generate the embedded signing URL right after that.
I see before you call GetRecipientView() that you are calling
envelope.UpdateStatus();
However, I don't see you set
envelope.Status = "sent";
...anywhere before that, which means you are requesting an embedded signing URL on an envelope which is in the draft state, which will generate an error.
It resolved by using "GetEmbeddedSignerView" method
Account account = InitializeDocSign();
Envelope envelope = new Envelope();
envelope.Login = account;
// assign the envelope id that was passed in
envelope.EnvelopeId = "xxxxx-xxx-xxx-xx-xxxxxxx";
var signer = new Signer
{
email = "xxxxx#gmail.com",
name = "AV xxxx 1",
clientUserId = "101",
recipientId = "1"
};
// generate the recipient view token
string signingUrl = envelope.GetEmbeddedSignerView("http://www.google.com", signer);

Resources