docusign / docusign-esign-node-client

The Official DocuSign Node.js Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
http://docusign.github.io/docusign-esign-node-client
MIT License
147 stars 100 forks source link

getTemplate gets error object {} and data as null when template has Dropdown field(recipients/signers/tabs/listTabs) #82

Closed ranjeshenboarder closed 5 years ago

ranjeshenboarder commented 6 years ago

Hello,

getTemplate gets error object {} and data as null when template has one or more Dropdown fields(recipients/signers/tabs/listTabs)

Version "docusign-esign": "3.2.1"

Sample client code used:

let authInfo= {accessToken:"...", accountIdGuid:"...", baseUrl:"..."}
let templatesApi = new docusign.TemplatesApi(module.exports.createApiClient(authInfo));

templatesApi.get(authInfo.accountIdGuid, templateid, null, 
    function (error, templateDetailData, response) {

We are able to get response using https://apiexplorer.docusign.com/#/esign/restapi?categories=Templates&tags=Templates&operations=get

Response sample JSON structure:
{
...
documents: [...]
recipients: {
 signers: [
  {
    tabs: {
      ...
      listTabs: [..]
      ...
  }
}

Thanks in advance, Ranjesh

mmallis87 commented 6 years ago

@ranjeshenboarder I'm not sure what your createApiClient method does, but if you wanna use this SDK you probably have to follow the steps described in the readme:

let apiClient = new docusign.ApiClient();
apiClient.setBasePath(authInfo.baseUrl);
apiClient.addDefaultHeader('Authorization', 'Bearer ' + authInfo.accessToken);
let templatesApi = new docusign.TemplatesApi(apiClient);

Good luck and happy DocuSigning!

ranjeshenboarder commented 6 years ago

@mmallis87 Thank you so much for taking the time to look into this and responding. My apologies, createApiClient was abstracted earlier, it does the same thing as given. The API works fine other than this special scenario 'when template has Dropdown field'

createApiClient: function(authInfo){ // initialize the api client let apiClient = new docusign.ApiClient(); apiClient.setBasePath(authInfo.baseUrl); apiClient.addDefaultHeader('Authorization', 'Bearer ' + authInfo.accessToken); return apiClient; }

let templatesApi = new docusign.TemplatesApi(module.exports.createApiClient(authInfo)); templatesApi.get(authInfo.accountIdGuid, templateid, null, function (error, templateDetailData, response) {

Attached screen of sample dropdown field. image

LarryKlugerDS commented 5 years ago

I tested this issue and did not find a problem. My test program is available to you, see branch issue_82 of the example repo.

Try it yourself, the test is example workflow number 9.

The API call:

    let dsApiClient = new docusign.ApiClient();
    dsApiClient.setBasePath(args.basePath);
    dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
    let templatesApi = new docusign.TemplatesApi(dsApiClient);
    let results = await templatesApi.get(args.accountId, args.envelopeArgs.templateId);

The results

Note the listTabs item -- that's a drop down menu.

{
   allowMarkup: "false",
   allowReassign: "true",
   autoNavigation: "true",
   customFields: {
      listCustomFields: [],
      textCustomFields: [
         {
            fieldId: "10192761569",
            name: "Order ID",
            required: "false",
            show: "true",
            value: ""
         }
      ]
   },
   documents: [
      {
         display: "inline",
         documentGroup: "content",
         documentId: "1",
         includeInDownload: "true",
         name: "Lorem Ipsum",
         order: "1",
         pages: "1",
         signerMustAcknowledge: "no_interaction",
         templateLocked: "false",
         templateRequired: "false",
         uri: "/envelopes/77b6fbef-1448-4ac3-819f-253a9e1cb08e/documents/1"
      }
   ],
   emailBlurb: "",
   emailSubject: "Please sign this document",
   enableWetSign: "true",
   enforceSignerVisibility: "false",
   envelopeIdStamping: "true",
   envelopeTemplateDefinition: {
      created: "2019-01-15T20:16:28.0030000Z",
      description: "Example template created via the API",
      folderId: "391c9d5f-a81d-4916-87de-30efc38fa3bd",
      folderName: "Templates",
      folderUri: "/folders/391c9d5f-a81d-4916-87de-30efc38fa3bd",
      lastModified: "2019-01-19T21:29:36.8870000Z",
      lastModifiedBy: {
         email: "larry.kluger@docusign.com",
         uri: "/users/14499850-43f1-4184-944f-55e5fed18870",
         userId: "14499850-43f1-4184-944f-55e5fed18870",
         userName: "Larry Kluger"
      },
      name: "Example Signer and CC template",
      owner: {
         email: "larry.kluger@docusign.com",
         userId: "14499850-43f1-4184-944f-55e5fed18870",
         userName: "Larry Kluger"
      },
      pageCount: 1,
      password: "",
      shared: "true",
      templateId: "77b6fbef-1448-4ac3-819f-253a9e1cb08e",
      uri: "/templates/77b6fbef-1448-4ac3-819f-253a9e1cb08e"
   },
   recipients: {
      agents: [],
      carbonCopies: [
         {
            accessCode: "",
            agentCanEditEmail: "false",
            agentCanEditName: "false",
            email: "",
            inheritEmailNotificationConfiguration: "false",
            name: "",
            note: "",
            recipientId: "2",
            recipientIdGuid: "00000000-0000-0000-0000-000000000000",
            requireIdLookup: "false",
            roleName: "cc",
            routingOrder: "2",
            templateLocked: "false",
            templateRequired: "false"
         }
      ],
      certifiedDeliveries: [],
      editors: [],
      inPersonSigners: [],
      intermediaries: [],
      recipientCount: "2",
      seals: [],
      signers: [
         {
            accessCode: "",
            agentCanEditEmail: "false",
            agentCanEditName: "false",
            defaultRecipient: "false",
            deliveryMethod: "email",
            email: "",
            inheritEmailNotificationConfiguration: "false",
            name: "",
            note: "",
            recipientId: "1",
            recipientIdGuid: "00000000-0000-0000-0000-000000000000",
            requireIdLookup: "false",
            roleName: "signer",
            routingOrder: "1",
            signInEachLocation: "false",
            tabs: {
               checkboxTabs: [
                  {
                     documentId: "1",
                     locked: "false",
                     name: "",
                     pageNumber: "1",
                     recipientId: "1",
                     required: "true",
                     requireInitialOnSharedChange: "false",
                     selected: "false",
                     tabId: "274136d6-ef0f-43b2-a207-302c9311949e",
                     tabLabel: "ckAuthorization",
                     xPosition: "75",
                     yPosition: "417"
                  },
                  {
                     documentId: "1",
                     locked: "false",
                     name: "",
                     pageNumber: "1",
                     recipientId: "1",
                     required: "true",
                     requireInitialOnSharedChange: "false",
                     selected: "false",
                     tabId: "b51a74ab-1b7e-468f-b739-ebf7e7cb7782",
                     tabLabel: "ckAuthentication",
                     xPosition: "75",
                     yPosition: "447"
                  },
                  {
                     documentId: "1",
                     locked: "false",
                     name: "",
                     pageNumber: "1",
                     recipientId: "1",
                     required: "true",
                     requireInitialOnSharedChange: "false",
                     selected: "false",
                     tabId: "b9f82d98-5270-43b1-82c5-ba67d5228ffe",
                     tabLabel: "ckAgreement",
                     xPosition: "75",
                     yPosition: "478"
                  },
                  {
                     documentId: "1",
                     locked: "false",
                     name: "",
                     pageNumber: "1",
                     recipientId: "1",
                     required: "true",
                     requireInitialOnSharedChange: "false",
                     selected: "false",
                     tabId: "e4858215-2429-4205-b62a-84e7e8d535b9",
                     tabLabel: "ckAcknowledgement",
                     xPosition: "75",
                     yPosition: "508"
                  }
               ],
               formulaTabs: [
                  {
                     bold: "false",
                     concealValueOnDocument: "false",
                     disableAutoSize: "false",
                     documentId: "1",
                     font: "helvetica",
                     fontColor: "black",
                     fontSize: "size14",
                     formula: " [numbersOnly] ",
                     hidden: "false",
                     italic: "false",
                     locked: "false",
                     originalValue: "",
                     pageNumber: "1",
                     recipientId: "1",
                     requireAll: "false",
                     required: "true",
                     roundDecimalPlaces: "2",
                     tabId: "37335712-5e3c-491d-b3b0-45c8ab560bdc",
                     tabLabel: "Formula 608310cf-5cb0-4b57-a0bb-061fa7118615",
                     templateLocked: "false",
                     templateRequired: "false",
                     underline: "false",
                     value: "",
                     width: 42,
                     xPosition: "267",
                     yPosition: "265"
                  }
               ],
               listTabs: [
                  {
                     documentId: "1",
                     font: "helvetica",
                     fontSize: "size14",
                     listItems: [
                        {
                           selected: "false",
                           text: "Red",
                           value: "red"
                        },
                        {
                           selected: "false",
                           text: "Orange",
                           value: "orange"
                        },
                        {
                           selected: "false",
                           text: "Yellow",
                           value: "yellow"
                        },
                        {
                           selected: "false",
                           text: "Green",
                           value: "green"
                        },
                        {
                           selected: "false",
                           text: "Blue",
                           value: "blue"
                        },
                        {
                           selected: "false",
                           text: "Indigo",
                           value: "indigo"
                        },
                        {
                           selected: "false",
                           text: "Violet",
                           value: "violet"
                        }
                     ],
                     locked: "false",
                     pageNumber: "1",
                     recipientId: "1",
                     requireAll: "false",
                     required: "false",
                     tabId: "e97f4f4e-d0ab-4e54-aaaa-7fb311cd0301",
                     tabLabel: "list",
                     value: "",
                     width: 78,
                     xPosition: "142",
                     yPosition: "291"
                  }
               ],
               numberTabs: [
                  null
               ],
               radioGroupTabs: [
                  {
                     documentId: "1",
                     groupName: "radio1",
                     radios: [
                        {
                           locked: "False",
                           pageNumber: "1",
                           required: "False",
                           selected: "false",
                           value: "white",
                           xPosition: "142",
                           yPosition: "384"
                        },
                        {
                           locked: "False",
                           pageNumber: "1",
                           required: "False",
                           selected: "false",
                           value: "red",
                           xPosition: "74",
                           yPosition: "384"
                        },
                        {
                           locked: "False",
                           pageNumber: "1",
                           required: "False",
                           selected: "false",
                           value: "blue",
                           xPosition: "220",
                           yPosition: "384"
                        }
                     ],
                     recipientId: "1",
                     requireAll: "false",
                     requireInitialOnSharedChange: "false",
                     shared: "false",
                     templateLocked: "false",
                     templateRequired: "false"
                  }
               ],
               signHereTabs: [
                  {
                     documentId: "1",
                     name: "SignHere",
                     optional: "false",
                     pageNumber: "1",
                     recipientId: "1",
                     scaleValue: 1,
                     stampType: "signature",
                     tabId: "caa98c4f-70fc-452e-8996-b96538e6a468",
                     tabLabel: "Sign Here",
                     xPosition: "191",
                     yPosition: "148"
                  }
               ],
               textTabs: [
                  {
                     concealValueOnDocument: "false",
                     disableAutoSize: "false",
                     documentId: "1",
                     font: "helvetica",
                     fontSize: "size14",
                     height: 22,
                     locked: "false",
                     pageNumber: "1",
                     recipientId: "1",
                     requireAll: "false",
                     required: "false",
                     tabId: "78bee0e7-122d-49a0-b2a7-0b5504036a2b",
                     tabLabel: "text",
                     value: "",
                     width: 84,
                     xPosition: "153",
                     yPosition: "230"
                  }
               ]
            },
            templateLocked: "false",
            templateRequired: "false"
         }
      ]
   },
   signingLocation: "online"
}