Search code examples
docusignapi

Populating Tabs In An Existing Draft Envelope With The tabLabel


Is it possible to map data to tabs in an existing envelope using tabLabels? If not, do I just need to specify the tabId to indicate which tab should be populated with my data or is there a different identifier that I should use?

Background - I've been populating tabs while creating envelopes with a template based on this process. So if I'm populating a text tab, my json looks like:

{
    "textTabs": [
        {
            "tabLabel": "text",
            "value": "Jabberwocky!"
        }
    ]
}

I'm mapping the contents of form fields from another form building service to the tabs in my DocuSign form and since I can specify which tabs should be populated based on the tabLabel, I've mapped my form fields to tabLabels. This works fine when creating a draft envelope.

But I need to populate more tabs in my draft envelope with the contents of subsequent form submissions from separate forms. I'd like to use my existing map of form fields > tabLabels but when I try with Envelopes Update or EnvelopeRecipientTabs (I'm not sure which I need to use here), DocuSign adds new tabs to my envelope, rather than mapping my data to the existing tabs 🥲

As far as I can tell, unique tabIds are generated each time a new envelope is created. So it'd be much easier to use tabLabels, which are always the same for each envelope.


Solution

  • In the end I did have to use tabIds when updating recipient text, checkbox and radio tabs in a draft envelope but that's it.

    As I mentioned, when populating tabs while creating an envelope I can use the tabLabel + value. When updating tabs, I can use the tabId + value.

    Rather than creating a new map based on tabIds, I was able to fetch the draft envelope's recipient tabs and match them with the keys in my existing map, based on the tab's tabLabel, which remained the same after the draft envelope was created.

    Examples


    Text or checkbox tabs

    During envelope creation:

    newTab = [
        'tabLabel': label,
        'value': tabValue
    ]
    

    Updating recipient tabs for a draft envelope:

    newTab = [
        'tabId': tabId,
        'value': tabValue
    ]
    

    Radio button tabs

    During envelope creation:

    radioButton = [
        'selected': true,
        'value': value
    ]
    

    Updating recipient tabs for a draft envelope:

    radioButton = [
        'selected': true,
        'tabId': tabId
    ]
    

    Obviously radio button tabs need to be put in a group like

    newTab = [
        'groupName': groupName,
        'radios': [radioButton]
    ]