Brad
Brad

Reputation: 15

Docusign API Multiple Line Items

I am implementing a Docusign API integration to another platform. The other platform has quotes which have quote line items. Each line item might have 4 fields, for example, such as "name," "price," "quantity," "total" to make this question very basic.

I am looking for the simplest way possible to have the Docusign document reflect the information from the quote line items. For example, if a quote has two line items, the Docusign document will have two line items, each line item have the four fields associated with the line item of "name," "price," "quantity," and "total," for example. If the quote had 12 line items, have 12 line items on the docusign document, each line item with the four basic descriptive fields I have just listed. I.e., I want the list size to be dynamically sized instead of just putting a ton of fields on the docusign document that may or may not be filled.

One possible thought that I had was to just create fields for each of the line items, specifying the x positions, and then just incrementing the y position of those fields to make the fields display properly. What I am after is wondering if there is some pre-existing tool or resource like the ability to repeat fields, or some table setup that receives lists as the input or something. I have worked with Docusign to Salesforce in the past, and it seems like there was something like this that was able to accept lists. Thank you in advance for your answers.

Here is my question in the form of a drawing: https://i.sstatic.net/C3iQk.jpg

Upvotes: 0

Views: 827

Answers (1)

Praveen Reddy
Praveen Reddy

Reputation: 7393

You can place hidden Anchor Text on your document for the line items.

From Documentation

When creating or editing a document, type the automatic anchor text in the appropriate location in the document.

  • After typing the anchor text, change the color of the anchor text to white or to the background color of the document. This way, the anchor text does not appear when the document is viewed, making the anchor text invisible to the recipients of the document.

When creating your envelope just supply the LineItems that you want to appear on the document. DocuSign will automatically match the anchor strings that you provide in your request and place the tabs appropriately.

Here is a sample CreateEnvelope request that creates two lines items by matching the anchor strings in the document.

{
    "emailSubject": "Please sign the agreement",
    "status": "created",
    "recipients": {
        "signers": [
            {
                "name": "Jane Doe",
                "email": "[email protected]",
                "recipientId": "1",
                "tabs": {
                    "textTabs": [
                        { "anchorString": "name1", "width": "70" },
                        { "anchorString": "price1", "width": "60" },
                        { "anchorString": "quantity1", "width": "60" },
                        { "anchorString": "total1", "width": "80" },
                        { "anchorString": "name2", "width": "70" },
                        { "anchorString": "price2", "width": "60" },
                        { "anchorString": "quantity2", "width": "60" },
                        { "anchorString": "total2", "width": "80" }
                    ]
                }
            }
        ]
    },
    "documents": [
        {
            "documentId": "1",
            "name": "Contract",
            "fileExtension": "txt",
            "documentBase64": "DQogICAgICAgIG5hbWUxICAgICAgIHByaWNlMSAgICAgICBxdWFudGl0eTEgICAgIHRvdGFsMQ0KCQkNCiAgICAgICAgbmFtZTIgICAgICAgcHJpY2UyICAgICAgIHF1YW50aXR5MiAgICAgdG90YWwyDQoJCQ0KICAgICAgICBuYW1lMyAgICAgICBwcmljZTMgICAgICAgcXVhbnRpdHkzICAgICB0b3RhbDMNCgkJDQogICAgICAgIG5hbWU0ICAgICAgIHByaWNlNCAgICAgICBxdWFudGl0eTQgICAgIHRvdGFsNA0KCQkNCiAgICAgICAgbmFtZTUgICAgICAgcHJpY2U1ICAgICAgIHF1YW50aXR5NSAgICAgdG90YWw1DQoJCQ0KICAgICAgICBuYW1lNiAgICAgICBwcmljZTYgICAgICAgcXVhbnRpdHk2ICAgICB0b3RhbDYNCgkJDQogICAgICAgIG5hbWU3ICAgICAgIHByaWNlNyAgICAgICBxdWFudGl0eTcgICAgIHRvdGFsNw0KCQkNCiAgICAgICAgbmFtZTggICAgICAgcHJpY2U4ICAgICAgIHF1YW50aXR5OCAgICAgdG90YWw4CQk="
        }
    ]
}

Here is the original document vs document after text tabs are placed on it. enter image description here

Upvotes: 1

Related Questions