DocuSign - Template with 2 Roles - Last Recipient Can Add Fields to Document - docusignapi

I'm not sure if something has changed but I'm seeing something I haven't seen before. I have a simple DocuSign Template with 2 Roles and 2 Recipients. There are 3 sets of tabs for Sign Here, Date Signed and a Text tab for them to enter some text.
I create the Envelope and send it - the envelope looks like this:
{
"emailSubject" : "Please Sign the Agreement",
"status" : "sent",
"templateId" : "xxxxxxx",
"templateRoles" :
[
{
"email" : "fred#flinstones.com",
"name" : "Fred Flinstone",
"roleName" : "Tenant",
"routingOrder" : "1",
"tabs" : {}
},
{
"email" : "barney#rubble.com",
"name" : "Barney Rubble",
"roleName" : "Landlord",
"routingOrder" : "2",
"tabs" : {}
}
]
}
The first recipient sees the Agreement and can Sign etc normally for their assigned tabs and finish, which sends it to the 2nd recipient. However they get a view that doesn't prompt them to sign etc like the first recipient, but instead they get a view similar to editing the Template. In the top left it says Drag and drop fields from the left panel onto the document and has a list of fields that can be dragged onto the document:
Once the fields are dragged the Finish button appears - I've never seen this and can't understand why this happens for the 2nd role/recipient and not the first. Previously it was the same for all recipients - they would simply be prompted to sign and enter the text field and not have to drag the fields onto the document etc.

So, there are two views you can get when you sign:
Pre-defined view, which prompt user where to sign.
Tagger view, which looks like when you create a template or send an envelope. It's also known as "free-form" signing.
the latter view would show if no tabs (signing elements) were defined for the recipient. You need to check your template to ensure you places these elements for both recipient separately.
this can also be done from your code, by adding the tabs programatically.

Related

Using Design Documents to add an element to a list

Users can press a button on my website to declare interest in a course. For every course there is a document in my CouchDB installation. These documents look like this:
{
"_id": "...",
"_rev": "...",
"name": "...",
"description": "...",
"userList": []
}
When a users presses the button his name should be added to "userList". I wrote a Design Document for this:
{
"_id": "_design/updateList",
"_rev": "...",
"updates": {
"addUser": "function(doc, req) {doc['userList'] = req['name']; var message = 'user added'; return [doc, message];}",
}
}
I know that this cannot be the right solution because the list can never be longer than one user name like this. However, not even that works. When I press on the button, the line ""userList": []" disappears from the corresponding document.
What's the problem here? I use PHP-On-Couch to run the Design Document but there shouldn't be any problems in my PHP code. I see in the CouchDB log that CouchDB receives the user name just fine.
The direct problem is that a req object does not have a field called "name" so:
doc['userList'] = req['name']
is equivalent to:
doc['userList'] = undefined
you may have meant to use userCtx req.userCtx.name directly if users are logged in, or req.query.name if you have added it as a parameter.
More generally, you probably meant to push their name on to the array which is probably fine if class sign up isn't very high volume. An alternate approach is to generate an independent document for each user+class and rely on views to count them.

Why is the DocuSign API setting wrong values in a pre-populated form on upload?

I've been able to create an envelope with about 6 pre-populated PDF documents in it, add a recipient, add about 4 signature tabs, and upload the envelope to DocuSign successfully. I've followed their C# example almost line-for-line on this, and it's worked perfectly. I can generate an embedded URL, and sign the document to completion. The only problem, however, is that it's auto-filling in some form values incorrectly. I can't figure out how to tell the API to leave the form as-is, and only collect the signatures.
The documents I'm uploading are standard PDF forms with the data already pre-populated. The data labels on the fields are indeed unique, but are structured similarly. For example, I have several date boxes with three fields each: month, day, year. The months for two date fields could be SignedDate.MM and DateOfBirth.MM, for example. If I have a value in DateOfBirth.MM of 05, but nothing in SignedDate.MM, the API is setting SignedDate.MM to 05 on upload, which it should not be doing.
Is there a setting or something I'm doing that could cause this behavior? For the record, if I manually upload the document through their online interface, this problem doesn't happen. I have no templates or custom fields set up in my account. I've also tried setting TransformPdfFields to false and TemplateLocked to true on Documents, Signers, and the Envelope. Nothing has worked so far.
Here's how I'm creating the envelope, documents, etc.:
// Create the documents
var docs = new List<Document>();
docs.Add(new Document()
{
DocumentBase64 = "CONTENT_HERE",
Name = "my-doc",
FileExtension = "pdf",
DocumentId = "1"
});
// Create the tabs
var signTabs = new List<SignHere>();
signTabs.Add(new SignHere()
{
RecipientId = "1",
TabLabel = "Sign Here",
AnchorString = "<Person.Signature>",
AnchorIgnoreIfNotPresent = "true",
AnchorMatchWholeWord = "true"
});
// Create the signing information
var signers = new Signer[] {
new Signer()
{
Email = "test#test.com",
Name = "Test Person",
ClientUserId = "1000",
RecipientId = "1",
RoutingOrder = "1",
Tabs = new Tabs() { SignHereTabs = signTabs }
}
};
// Create the recipients
var recipients = new Recipients() { Signers = new List<Signer>(signers) };
// Create the envelope
var envelope = new EnvelopeDefinition()
{
EmailSubject = "Document Signing",
Documents = docs,
Recipients = recipients,
Status = "sent"
};
return envelope;
Any insight into this problem would be appreciated!
If your PDF documents have PDF fields in them, then you will need to convert the fields to DocuSign fields.
The main technique is to ask DocuSign to convert them. After the fields are converted, you will need to assign them to one or more of your envelope recipients.
This is because PDF Form fields only know about the form as whole. In contrast, DocuSign fields (also know as tabs) are always associated with specific recipient(s). This enables each recipient to update/sign their own fields. (You can also enable a field to be modified by more than one recipient, but that's a different topic.)
To have the PDF form fields converted to DocuSign fields, check out the documentation.
In summary, you will use composite templates to both indicate that a recipient is the defaultRecipient (so they will have the PDF Form Fields assigned to them.) and indicate that each document's PDF Form Fields should be transformed (using the transformPdfFields field):
{
"status": "sent",
"emailSubject": "Transform PDF Fields Example 1",
"recipients": {
"signers": [{
"email": "john#email.com",
"name": "Jon Dough",
"recipientId": "1"
}]
},
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "john#email.com",
"name": "Jon Dough",
"recipientId": "1",
"defaultRecipient": "true"
}]
}
}],
"document": {
"documentId": "1",
"name": "irs_f4506t.pdf",
"documentBase64": "<base64 encoded bytes>",
"transformPdfFields": "true"
}
}]
}
It is also possible to use the Composite Templates feature to assign some of the PDF Form Fields to recipient 1 and others to recipient 2, as needed.
DocuSign was able to reproduce the issue on their end, and they submitted a bug report to their developers. They're not sure why it's happening, but they believe it has something to do with a hidden attribute/annotation on the form fields themselves.
In the meantime, I was able to run the PDF through Spire.PDF, search for all the empty form fields, and set their values to an empty string. This seems like it should have no effect (setting an empty value to an empty value), but Spire.PDF must be resetting some attributes/annotations under the covers because this fixes my problem.

DocuSign API - RecipientView - How do you specify Excluded Documents?

From https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeRecipients I can see that when creating an Envelope Recipient, you can specify a list of documents within the DocuSign envelope that the Envelope Recipient cannot view.
I want to use similar functionality when creating a recipient view request (ie. https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient#recipientViewRequest). Specifically, when creating a recipient view request I want to specify which documents the viewer can see/not see. However, I do not see an ExcludedDocuments parameter or similar.
How can I
The RecipientView is simply the API method for obtaining an URL to a Signing Ceremony for a particular recipient.
If you don't want a recipient to see a document, then you must use Document Visibility--that includes using the excludedDocuments attribute, but other attributes and tabs need to be set up too.
Once you have an envelope with document visibility set up for some/all of the recipients, you can use RecipientView to obtain the URL for a specific recipient's signing ceremony.
Larry's response above is correct.
To set the document visibility for a specific recipient you could use this API endpoint:
PUT {vx}/accounts/{accountid}/envelopes/{envelopeid}/recipients/{recipientid}/document_visibility
this is the information that you can set in the request body
{
"documentVisibility": [
{
"recipientId": "sample string 1",
"documentId": "sample string 2",
"visible": "sample string 3",
"rights": "sample string 4"
}
]
}
so it could be something like this:
{
"documentVisibility": [{
"documentId": 1,
"visible": false
}]
}
I hope this helps!

How to populate DocuSign Name field with something other than Sender name?

I'm using DocuSignAPI SDK to send envelopes. I have a few templates defined and they use a Custom Field called MemberFullName.
The field is of type Name, FullName.
For some templates I want MemberFullName map to a Signer's name, but sometimes I want to map another name to it.
My assumption was if I don't map anything to MemberFullName, then Signer's name will be used. But if I add "fullNameTabs" for MemberFullName, then it will be mapped.
Signer sgnr = new Signer()
{
RoleName = "Someone other than Member",
RecipientId = "1",
Name = "Bob Signer",
Email = "bobsemailaddress#yahoo.com"
};
sgnr.Tabs.FullNameTabs = new List<FullName>();
sgnr.Tabs.FullNameTabs.Add(new FullName() { TabLabel = "MemberFullName", Name = "Joe Smith" });
But MemberFullName is still mapped to Signer name in the resulting document.
How can I map a NON-SIGNER name to a field of type "Name"?
I know I can create a different field of type TEXT and map "Joe Smith" to it, but I wanted to reuse the "MemberFullName" field in both situations.
I apologize as I may not be using correct "docusign terminology" for things.
You will not be able to set the value of FullName tab manually. See this answer
for more information.

Automatic document updates in couchdb

I have 10,000+ couchdb documents, each having (simplified) format like -
{
"First Name" : "John",
"Last Name" : "Doe"
}
I want to add another field to this document, which is e-mail, so that document now looks like -
{
"First Name" : "John",
"Last Name" : "Doe",
"e-mail" : ""
}
I understand that I can easily update this document by inserting a new JSON, in new format.
But my question is how can I add new field automatically to "all 10,000+" docs that I have existing in the DB? Do I need to write my own script to read each doc and update each one of them individually? Or is there a simpler way?
If you use views to access your data, you can modify the view without having to modify the documents. Just emit an email value with a default of "".
Assuming the above is no good, use a view to show you which documents need upgrading.
function(doc) {
// views.email_upgrade.map
if(! ('e-mail' in doc)) {
var key = [doc["Last Name"], doc["First Name"]];
emit(key, {_id:doc._id, _rev:doc._rev});
}
Query /db/_design/foo/_view/email_upgrade?include_docs=true. You can add a &limit=N property to help. Query. The doc value in each row is a document that needs to upgrade. You can send them back with POST /db/_bulk_docs. Loop until you have 0 rows. Once you have 0 rows, add a check to your validate_doc_update function.

Resources