In docusign interface, there is an option to change the order of the documents in a template. Is it possible to re-order the documents in a template using REST APIs?
I have a requirement where end-user should be able to
a) select the templates
b) re-order the documents in selected templates
c) Application should form envelope using selected templates and send it.
Both (a) and (c) features are working fine using REST APIs but when it comes to re-ordering the documents within the template, I am unable to find a solution.
This is the JSON request I am using for composite templates:
{"serverTemplates": [
{
"sequence": "1",
"templateId": "'.$template_id.'"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "'.$emp_rec['email_id'].'",
"name": "'.$emp_rec['name'].'",
"recipientId": "1",
"roleName": "Employee",
"routingOrder": "1"
}
]
}
}
]
}
Let me know if any more information required.
The order of documents appearing in an envelope is based on the order used when creating the envelope. The only exception to this is if building a draft envelope and using the PUT .../envelopes api call to add documents to the draft. This method supports the use of "order". Therefore, if creating an envelope via composite templates, the order of documents in the envelope is based on the order of the composites.
For Composite Template envelope construction, you should think of each composite as a "unit of document contribution". In your snippet of a single composite, the lowest numbered sequence is the server template, so it will contribute the document(s) from the server template. All other referenced templates will be "applied" to that document.
It isn't clear from your question whether you want to add documents from server templates or if you are saying that the particular server template has 2 or more documents in the template. If the latter, I strongly recommend breaking them apart into their own individual templates. This will give you maximum flexibility. Since a multi-document server template can't really be applied to a contributed document, I view them as only useful when creating an envelope from that single template.
Related
I have an envelope with a single document and two signers saved as a server-side template. The signers execute the agreement in a specific order. The document has a number of pre-fill fields in it.
I am trying to automate sending this agreement out using Integromat. Unfortunately, Integromat's module doesn't allow for pre-fill fields in templates, leaving me to create the API request manually. This is where I get stuck.
The closest I have come is the JSON request below, POSTed to:
…/v2.1/accounts/{accountId}/envelopes, with capitalised values filled in automatically:
{
"templateId": "TEMPLATE_ID",
"templateRoles": [
{
"email": "CLIENT_EMAIL",
"name": "CLIENT_NAME",
"roleName": "Recipient",
"tabs": {
"prefillTabs": {
"textTabs": [{
"tabLabel": "Prefill: Purpose",
"value": "PURPOSE_FIELD_DATA"
}]
}
}
}, {
"email": "STAFF_EMAIL",
"name": "STAFF_NAME",
"roleName": "Company"
}
],
"status": "sent"
}
The response from the API is:
The operation failed with an error. [400] A Required field is
incomplete. TabId: GUI_HERE
What I can't figure out is how to get the pre-fill data submitted since it's not tied to a particular signer. I have scoured the v2.1 API documentation but there is no scenario simple enough for this request.
Apologies if I am missing something obvious here; this is my first rodeo with DocuSign's API.
Do you have any idea what I am doing wrong or, better yet, what the body of the request should be for this (presumably) simple scenario?
Update: For pre-fill tabs, you need to have both the tabId and tabLabel, not enough to just have tabLabel like regular tabs.
My guess is a mismatch of the tabId field for the tabs on your template vs. what's in the API request:
You had this value in your request:
Prefill: Purpose
Does it match how the template was set?
I just tried this with composite templates.
When I added the prefill tabs to a recipient I received the error
Error code: INVALID_TAB_OPERATION.
Message: The Tab specified is not valid for the requested operation.
PrefillTab not allowed for recipient.
which makes sense since prefill tabs are associated with a document, not a recipient.
I tried by adding a document to the composite template, but that didn't work either.
I suggest that you use regular tabs. Mark them locked so they can't be changed. Mark them shared so every signer will see them. Then fill in their values as part of your Envelopes:create call.
Here's a live example of doing this. Note the text2 tab which is locked. (It should have the shared attribute set to true. You can add that from the Tabs/text toolbox on the left.)
Also see this blog post about templates.
Integromat does even without using DocuSign Rest APIs.
You can use Powerforms, it will save your cost for Rest APIs.
I recently did this, but issue is for first recipient, you need to send email manually with powerform link.
Here I dynamically construct PowerForm URL where I pass values to pre populate template fields.
To send email from integromat, you can configure Gmail module or any other email module and create html template where you can append Powerform URL in anchor tag
I'm using a template with a bunch of standard text fields defined via the browser UI placing fields on a document background. I've selected the "fixed" option for each of these fields, however the text when programmatically filled in via an api call is not wrapping and instead extending outside the prescribed area. How can i have this programmatic value entry of fields but still have them respect the width of the field?
Have tried setting the "fixed" attribute on the field in the template definition UI.
I won't paste the full json I'm passing as it's huge, but I'm using the same tabLabel/value format from the DocuSign example as seen here:
{
"accountId": "301424",
"emailSubject": "API Example - Populating Data in Templates",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
"templateRoles": [{
"email": "john.doe#email.com",
"name": "John Doe",
"roleName": "Customer",
"tabs": {
"textTabs": [{
"tabLabel": "CustomerAddress",
"value": "123 Main St. San Francisco, CA 94105"
},
{
"tabLabel": "CustomerSSN",
"value": "12-345-6789"
}]
}
}],
"status": "sent"
}
Expected result would be a wrapped text in the field, however am actually getting text running into subsequent fields:
What I've defined in the template:
What I'm getting in the output (obviously not ideal):
For text fields (text tabs) if you want multiple lines give the field a larger height to enable two (or more) lines of text. The text should wrap automatically.
The height a line of text takes up depends on the text size for the field, which you can set.
You're setting the initial value via the API--will the signer be able to change it? That's a common use case for setting the initial values--enable the signer to update/correct the data as needed. (And DocuSign will tell your app whether the signer changed the value or not.)
If you're setting the value of the field and the signer can not change the value, then you're using using DocuSign as a custom document (not form) generator. That's fine, many apps do that.
If you run into an issue that DocuSign doesn't support then an alternative is to create the custom document using a different technique.
For example, you could create the document in HTML (programmatically) and DocuSign will convert it to a PDF for signing. Or you can create a customized PDF
document yourself, there are many libraries available.
I saw we have API calls to create / list Envelope Custom fields.
https://docs.docusign.com/esign/restapi/Accounts/AccountCustomFields/
Is there a call to create Document Custom field to populate in the Admin section , so that we can use it in any template .
https://admindemo.docusign.com/custom-fields
Admin section screen
I believe the operation you're looking for is Create Custom Tabs, which is defined here in the docs: https://docs.docusign.com/esign/restapi/CustomTabs/CustomTabs/create.
The following request creates a new Document Custom Field called "AccountID" that's a required Text Tab with maximum length of 10.
POST /v2/accounts/{accountId}/tab_definitions
{
"tabLabel": "AccountID",
"maximumLength": "10",
"required": "true",
"type": "Text",
}
After this request is executed, the new field (AccountID) is listed on the Document Custom Fields page within the DocuSign web UI (and is available for use in Templates and Envelopes).
We want to integrate docusign functionality in our product where we allow our product users to map PDF Forms to database fields and populate the PDF form as per the mapping.
We want our users to populate PDF forms with appropriate data as per the configured mapping in our application, before they send the filled PDF form to get it signed from different associated recipients. Original PDF form will be same but its fields will contain different data as per the intended recipient.
We do not want users to repeatedly configure Signing Tabs (Tags) for the same PDF forms again and again.
So we thought trying Templates feature available in docusign. I just want to confirm before implementing Templates feature, whether Template feature will allow me to Send the same PDF form with associated recipeints data filled up from our application and send the filled PDF form to recipients to sign.
As per the documentation it is not clear, whether I can upload the document’s bytes of the document to be signed while using the template feature.
Yes you can definitely populate different values for different recipients when using the same DocuSign template. They would not be very useful if you could not.
This has been answered through other posts, see here for example:
Not able to pass in values to docusign template
You just need to use the tabLabel to identify the tab you want to populate and then use the value field to populate it's value dynamically. For instance, to populate to two text fields (ie data tabs) you would do:
{
"accountId": "221765",
"emailSubject": "DocuSign Templates Webinar - Example 2",
"emailBlurb": "Example #2 - Dynamically Populate Form Fields",
"templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
"templateRoles": [
{
"email": "jondow#email.com",
"name": "Jon Dow",
"roleName": "RoleOne",
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantName",
"value": "John Doe"
},
{
"tabLabel": "ApplicantSSN",
"value": "12-345-6789"
}
]
}
}
],
"status": "sent"
}
I have a document that is very similar to a Purchase Order that needs to be sent out for a signature through DocuSign.
There's header type data that is fixed and can easily be placed on the document and then filled with tabs.
Along with this, there are Details which may be 1 or more. I'm wondering what the best strategy to use is to create this type of Document with Docusign API?
Edit: Including a sample of the PDF that needs to be produced:
TIA
Anchor strings would be a good option to explore, even moreso if all you need from DocuSign is a Signature (and/or Date Signed) tab.
EDIT: For example, on your document you could whitetext "sig1" where you want the recipient to sign.
"signers": [
{
"email": "testsigner#test.com",
"name": "John Doe",
"recipientId": "1",
"routingOrder" : "1",
"tabs" : {
"signHereTabs" : [
{
"tabLabel" : "SignHere",
"anchorString" : "sig1"
}
]
}
}
]
},
See the screenshot I've attached. However, I did not white out my anchor.
One more thing to note. I created the test below from the WebApp. If using the API the bottom left of the tag will apply to the bottom left of the text.
You're really asking about dynamically creating a document first and foremost, then getting it signed via DocuSign.
You have a number of options:
Create a pdf dynamically. There are many libraries available for doing this. Just google for "creating a pdf ".
Create an html document dynamically, then either send it to DocuSign directly or first send it to a company that specializes in making nice documents from dynamic data. I like WebMerge for this.
When you send the doc to DocuSign, I agree with Rickey that Anchor Strings are a good way to have the signature in the right place. There's a recipe for placing DocuSign fields by using anchor strings.