How Can Fields With Validation be Prefilled in DocuSign? - c#

I have a field in my template that has validation for numbers only enabled. If I were to remove this validation, it would prefill the field on the document. Enabling it will not prefill that field. Is there a way to prefill validated fields?
I am using the latest version of DocuSign nuget package.
This is my code to prefill the data. It only works on non-validated fields.
var accountNumber = new Text
{
TabLabel = "AccountNumber",
Value = form.AccNo,
};
var tabList = new List<Text> {bankName, accountNumber, accountName};
formInfo.Tabs = new Tabs();
formInfo.Tabs.TextTabs = tabList;
envelope.TemplateRoles = new List<TemplateRole> { formInfo };
envelope.Status = "sent";
var summary = envelopesApi.CreateEnvelope(AccountID, envelope);

When you enable Validation for a field, it actually changes the field type. Instead of a Text, that tag will now be a Number:
var accountNumber = new DocuSign.eSign.Model.Number
{
TabLabel = "AccountNumber",
Value = form.AccNo
};
and it will need to go into a different Tabs list under your Recipient:
signer.Tabs = new Tabs
{
TextTabs = new List<DocuSign.eSign.Model.Text>
{
bankName,
accountName
},
NumberTabs = new List<DocuSign.eSign.Model.Number>
{
accountNumber
}
};
Other validation options can also change the tab type. Depending on what you're doing, you could be working with EmailTabs, DateTabs, SsnTabs or ZipTabs.

Related

Elasticsearch skip null values

there are empty fields in the document I created.
var settings = new ConnectionSettings(new Uri(uri)).DefaultIndex("person");
var client = new ElasticClient(settings);
for example;
var newPerson = new Person()
{
newPerson.Name = "Jack",
newPerson.Age = 30,
newPerson.Image = "";
}
var savePerson = client.Create(newPerson , i => i.Index("person"));
I don't want to save the "Image" field when saving.
Can I ignore this field or skip it while saving?
Set the property:
newPerson.Image = null;
and it won't be saved to elastisearch

Docusign SDK C# Radio Button Group ,Docusign The RecipientId specified in the tab element does not refer to a recipient of this envelope

I am getting this Issue on Docusign Radio group.I am
Docusign The RecipientId specified in the tab element does not refer to a recipient of this envelope. Tab refers to RecipientId 88183597-41B3-42C5-9E48-D1A4D5C3F262 who is not present.
This Works Fine:
return new RadioGroup
{
GroupName= Guid.NewGuid().ToString(),
DocumentId = documentId,
RecipientId = userId,
};
This doesn't work .
return new RadioGroup
{
GroupName= Guid.NewGuid().ToString(),
DocumentId = documentId,
RecipientId = userId,
Radios= new List<Radio>()
{
new Radio(){ PageNumber="1",Selected = "true",Value ="X",XPosition = "300", YPosition = "75" } ,
// new Radio(){ PageNumber="1",Selected = "false",Value ="Y",XPosition = "350", YPosition = "75" }
},
};
I am setting Signer Tabs as
signer.Tabs = new Tabs
{
SignHereTabs = signers,
InitialHereTabs = initialsHere,
DateSignedTabs = dateSinged,
ApproveTabs = approves,
DeclineTabs = declines,
FullNameTabs = fullNames,
CheckboxTabs = checkBoxes,
RadioGroupTabs = radiobuttongroups,
TextTabs = textboxes,
};
After Long debugging came to know that DocuSign converts Recipient Ids to lower case and somehow it was not matching TAB's Recipient ID, Had to convert Recipient IDs of signer and tabs to lower.

Can you have a returnUrlRequest for a sender view generated from a bulk send?

I'm trying to create a workflow where a user can do a bulk send through docusign within my application. They would select the clients they want to send forms to for a signature, be presented with a sender view to specify what fields they require, send it off, then have it post back to my application in order to generate emails for embedded signing. However, currently, it doesn't return back to my application after the user has sent off the bulk request despite the return url request being set. Is this currently not possible with a bulk send request?
The following is just some code to generate the sender view url:
// Create envelope definition
var envelopeDefinition = new EnvelopeDefinition
{
EmailSubject = documentDesc,
Documents = new List<Document>(),
Recipients = new Recipients { Signers = new List<Signer> {
new Signer
{
Name = "Multi Bulk Recipient::signer",
Email = "multiBulkRecipients-signer#docusign.com",
RoleName = "signer",
RoutingOrder = "1",
Status = "sent",
DeliveryMethod = "Email",
RecipientId = "1",
RecipientType = "signer"
}
} },
CustomFields = new CustomFields()
{
TextCustomFields = new List<TextCustomField>()
{
new TextCustomField() {Name = "Client", Value = _config.DatabaseName},
new TextCustomField() {Name = "Server", Value = _config.DatabaseServer},
new TextCustomField() {Name = "DocId", Value = documentId.ToString()}
}
},
EnvelopeIdStamping = "true",
};
// Read a file from disk to use as a document.
byte[] fileBytes = File.ReadAllBytes("test.pdf");
// Add a document to the envelope
Document doc = new Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = "TestFile.pdf";
doc.DocumentId = "1";
envDef.Documents = new List<Document>();
envDef.Documents.Add(doc);
// Add each recipient and add them to the envelope definition
var recipients = new List<BulkSendingCopyRecipient>();
var recipients = new List<BulkSendingCopyRecipient> {
new BulkSendingCopyRecipient
{
Name = "Bob Ross",
Email = "bobross#happymistakes.com",
ClientUserId = "1234",
CustomFields = new List<string>()
{
"A custom field for internal use"
},
RoleName = "signer"
},
new BulkSendingCopyRecipient
{
Name = "Fred Rogers",
Email = "mrrogers#neighborhood.com",
ClientUserId = "5678",
CustomFields = new List<string>()
{
"Another custom field for internal use"
},
RoleName = "signer"
}
};
var bulkSendingCopy = new BulkSendingCopy
{
Recipients = recipients
};
var bulkCopies = new List<BulkSendingCopy>
{
bulkSendingCopy
};
var bulkSendingList = new BulkSendingList
{
BulkCopies = bulkCopies
};
bulkSendingList.Name = "A document name";
envelopeDefinition.Status = "created";
var envelopesApi = new EnvelopesApi(config);
var bulkEnvelopesApi = new BulkEnvelopesApi();
var createBulkListResult = bulkEnvelopesApi.CreateBulkSendList(AccountId, bulkSendingList);
envelopeDefinition.CustomFields.TextCustomFields.Add(
new TextCustomField
{
Name = "mailingListId",
Required = "false",
Show = "false",
Value = createBulkListResult.ListId //Adding the BULK_LIST_ID as an Envelope Custom Field
}
);
var envelopeSummary = envelopesApi.CreateEnvelope(AccountId, envelopeDefinition);
var options = new ReturnUrlRequest
{
ReturnUrl = HttpContext.Current.Request.Url.Scheme + "://" +
HttpContext.Current.Request.Url.Authority +
HttpContext.Current.Request.ApplicationPath +
"/SIP/ConfirmTagSendAndPublish.aspx?idockey=" + documentId
};
var senderView = envelopesApi.CreateSenderView(AccountId, envelopeSummary.EnvelopeId, options);
var senderViewInfo = new string[2];
senderViewInfo[0] = senderView.Url;
senderViewInfo[1] = envelopeSummary.EnvelopeId;
return senderViewInfo;
When the sender view comes up and you hit send it just takes me to the Sent tab in docusign
What I see after send
So in order for you to do the scenario you're asking to do, you will have to take a slightly different approach:
Generate a regular envelope in draft mode with the things you need.
Have user interact with it in embedded sending experience.
Generate a bulk using the CreateBulkList() method based on the envelope from #2 and the users you add like in your code.
(to do #3 you may need to copy custom fields etc. from the initial envelope to the one used for custom fields)

DocuSign: Sending Template with Custom Fields

I'm using the DocuSign.eSign library from https://github.com/docusign/docuSign-csharp-client
I've created an EnvelopeDefinition:
var envDef = new EnvelopeDefinition()
{
CustomFields = new CustomFields()
{
TextCustomFields = new List<TextCustomField>()
{
new TextCustomField()
{
FieldId = "d9d584f6-0a3a-40df-b94f-407c1a90c87d",
Name = "A.LoanNumber",
Required = "true",
Show = "true",
Value = "1234567890",
},
},
},
EmailBlurb = "Don't panic! This is only a template test.",
EmailSubject = "Template Test...",
Status = "sent",
TemplateId = "458407ac-f0a0-44e6-a60b-5126e2d0a8cf",
TemplateRoles = new List<TemplateRole>()
{
new TemplateRole()
{
AccessCode = "1234",
Email = "jjeppson#example.com",
Name = "Josh Jeppson",
RoleName = "Borrower.1",
},
},
};
But no matter what combination of values I have used for properties of the TextCustomField, the default value for A.LoanNumber, "Loan Number", is output in the resulting document.
The envelope sends correctly but none of the fields (only one shown above) have been inserted/replaced in the document.
Using the specified library, how do I override the default values for the custom fields?

Adding document to docusign envelope always return false

I'm using the following code to try to add a pdf document to an existing template with multiple documents using the AddDocument function of the c# API but the result is always false. The template is succesfully sent with all the preset documents sent correctly. How do I correctly add the pdf document? I have to add the pdf document using code because this particular document is different every time we send the template. I have tested GetIPS function and it returned the byte[] for the pdf document so I know that's not the issue.
Here are my codes
byte[] ips = GetIPS("");
RestSettings.Instance.DocuSignAddress = "https://demo.docusign.net";
RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress + "/restapi/v2";
RestSettings.Instance.IntegratorKey = integratorKey;
DocuSign.Integrations.Client.Account account = new DocuSign.Integrations.Client.Account();
account.Email = username;
account.Password = password;
var loginResult = account.Login();
Template template = new Template();
template.TemplateId = templateId;
template.Login = account;
template.EmailSubject = emailSubject;
template.EmailBlurb = emailMessage;
var documents = template.GetDocuments();
TemplateRole tr = new TemplateRole();
var roles = new List<TemplateRole>();
//Handle Primary Client
roles.Add(new TemplateRole
{
roleName = "Primary Client",
name = primaryClientName,
email = primaryClientEmail,
tabs = new RoleTabs
{
textTabs = new RoleTextTab[] {
new RoleTextTab {
tabLabel = "FeeEffectiveDate",
value = effectiveDate
},
new RoleTextTab {
tabLabel = "FeePercentage",
value = fee
}
}
},
});
if (secondaryClientName.Trim().Length != 0)
{
roles.Add(new TemplateRole
{
roleName = "Secondary Client",
name = secondaryClientName,
email = secondaryClientEmail,
});
}
roles.Add(new TemplateRole
{
roleName = "President",
name = presidentName,
email = presidentEmail,
});
roles.Add(new TemplateRole
{
roleName = "Css",
name = cssName,
email = cssEmail,
});
template.TemplateRoles = roles.ToArray<TemplateRole>();
template.Status = "sent";
//The following code always return false
bool status = template.AddDocument(ips, "IPS.pdf", 1);
var result = template.Create();
In order to use the AddDocument function, an envelope must be in draft state (as you can also see in the remarks for this function in the source code). Therefore, in your case, you must first create a draft envelope (by changing the envelope status to "created"), then invoke the AddDocument function, and finally update the envelope status to "sent" to send the envelope.
For example:
.
.
.
template.Status = "created";
var result = template.Create();
bool status = template.AddDocument(ips, "IPS.pdf", 2);
template.Status = "sent";
result = template.UpdateStatus();
Note that the document index is the document ID, and is must be different from the IDs of the existing documents in your template. Otherwise, an existing document that has the same ID number, will be replaced by the new document.

Categories