簡體   English   中英

DocuSign Rest API - TAB_REFERS_TO_MISSING_DOCUMENT

[英]DocuSign Rest API - TAB_REFERS_TO_MISSING_DOCUMENT

我在嘗試通過 DocuSign Rest API (Java) 基於模板創建信封時遇到以下錯誤。 將錯誤消息作為不存在的特定文檔 ID 獲取。 我曾經上傳文檔 ID 為“1”的文檔,但對於一個模板,我遇到了以下錯誤。

Exception: com.docusign.esign.client.ApiException: {
  "errorCode": "TAB_REFERS_TO_MISSING_DOCUMENT",
  "message": "The DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 69681238 which is not present."
}

任何人都可以解釋上述情況嗎? 我需要對我的模板或代碼進行任何更改嗎? 我必須傳遞任何其他參數嗎?

信封創建代碼:

try {
    Path path = Paths.get(file);
    fileBytes = Files.readAllBytes(path);
} catch (IOException ioExcp) {
    System.out.println("Exception: " + ioExcp);
    return null;
}
// add a document to the envelope
Document doc = new Document();
String base64Doc = Base64.encodeBase64String(fileBytes);

doc.setDocumentBase64(base64Doc);
doc.setName(fileName); 

doc.setDocumentId("1");

List<Document> docs = new ArrayList<Document>();
docs.add(doc);
envDef.setTemplateId(templateId());
envDef.setDocuments(docs);

List<TemplateRole> templateRolesList = new LinkedList<TemplateRole>();
TemplateRole templateRole = new TemplateRole();

templateRole.setEmail(signerEmail);
templateRole.setName(signerName);
templateRole.setRoleName("Signer1");
templateRole.setRoutingOrder("1");
templateRolesList.add(templateRole);

TemplateRole templateRole2 = new TemplateRole();
templateRole2.setName(signerName1);
templateRole2.setRoleName("Signer2");
templateRole2.setRoutingOrder("2");
templateRole2.setEmail(signerEmail1);               
templateRolesList.add(templateRole2);

envDef.setTemplateRoles(templateRolesList);

envDef.setAllowRecipientRecursion("true");
envDef.setStatus("created");

try {
    EnvelopesApi envelopesApi = new EnvelopesApi();

    EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId(), envDef);

    DocumentTemplateList documentTemplateList = new DocumentTemplateList();
    DocumentTemplate documentTemplate = new DocumentTemplate();
    documentTemplate.setTemplateId(templateId());
    documentTemplate.setDocumentId(doc.getDocumentId());
    documentTemplateList.getDocumentTemplates().add(documentTemplate);

    envelopesApi.applyTemplateToDocument(accountId,
            envelopId(), doc.getDocumentId(),
            documentTemplateList);  


} catch (com.docusign.esign.client.ApiException ex) {
    System.out.println("Exception: " + ex);
    ex.printStackTrace();
}

正如您提到的從模板列表中獲取文檔 ID。 我得到的文檔數組為空。 這是回應。

class EnvelopeTemplateResult {
    templateId: <templateId>
    name: Template 1
    shared: true
    password: 
    description: 
    lastModified: 2017-06-06T19:45:35.7670000Z
    pageCount: 15
    uri: /templates/<uri>
    folderName: Templates
    folderId: <folderId>
    folderUri: /folders/<folderUri>
    parentFolderUri: null
    owner: class UserInfo {
        userName: User Name
        email: email@email.com
        userId: userID
        userType: null
        userStatus: null
        uri: null
        errorDetails: null
    }
    documents: []
    recipients: null
    transactionId: null
    status: null
    documentsUri: null
    recipientsUri: null
    asynchronous: null
    envelopeUri: null
    emailSubject: Sign Document
    emailBlurb: Please sign this document
    envelopeId: null
    signingLocation: Online
    customFieldsUri: null
    envelopeIdStamping: null
    authoritativeCopy: false
    notification: null
    notificationUri: null
    enforceSignerVisibility: false
    enableWetSign: true
    allowMarkup: false
    allowReassign: false
    createdDateTime: null
    lastModifiedDateTime: null
    deliveredDateTime: null
    sentDateTime: null
    completedDateTime: null
    voidedDateTime: null
    voidedReason: null
    deletedDateTime: null
    declinedDateTime: null
    statusChangedDateTime: null
    documentsCombinedUri: null
    certificateUri: null
    templatesUri: null
    messageLock: null
    recipientsLock: null
    brandLock: null
    brandId: null
    useDisclosure: null
    emailSettings: null
    purgeState: null
    lockInformation: null
    is21CFRPart11: null
    isUniversalSignatureEnvelope: null
}

如果沒有看到您的信封創建代碼,很難說出您的確切問題。

您很可能在創建信封期間使用了錯誤的 DocumentId。

使用listTemplateDocuments api 檢索模板上的文檔 ID。 在創建信封期間使用模板中的確切 DocumentId。

另請參閱此答案和此答案

我最近在使用復合模板時遇到了這個問題,所以我想分享一下,希望沒有人會陷入這個困境。

我們的模板試圖向文檔添加一個復選框組,該文檔的驗證為“完全選擇 1”,而復選框字段的錨字符串在我們通過 API 發送的文檔中不存在。 此驗證似乎導致模板根據需要解釋這些字段並給出此錯誤消息。 傳遞 API 在錯誤消息中返回的 documentId 解決了這個問題,但我們不想跟蹤 documentId,而寧願在運行時增量設置它們並將這些值用於文檔可見性。 完全刪除復選框組並傳遞我想要的任何 documentId(明確不是 API 吐回的 Id)解決了這個問題。

我們正在研究復選框的新解決方案,希望只使用單選按鈕。

我會仔細查看哪些字段對它們進行了任何類型的驗證,看看是否將它們一一刪除,然后運行您的請求,您可以找到罪魁禍首(這就是我找到復選框組驗證的方式)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM