You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在DocuSign REST API v2.1中向Composite Templates添加HTML文档遇阻求助

问题:使用DocuSign Composite Templates发送含动态HTML表格的信封时报错“You have no documents”

此前通过DocuSign Composite Templates引用3个服务器模板发送签署信封完全正常,现在需要新增一个包含Salesforce动态生成数据表格的文档,于是尝试在document对象中使用htmlDefinition属性传递Salesforce Apex侧生成的HTML标记,但发送请求后报错**“You have no documents”**,无法加载该HTML文档。

已验证:单独使用常规发送方法时,带htmlDefinition属性的文档可以正常发送,但在Composite Templates场景下无效。

原请求示例:

{"status": null,"enforceSignerVisibility": "true","emailSubject": "EMAIL_SUBJECT","emailBlurb": "EMAIL_BLURB","compositeTemplates": [{"serverTemplates": null,"inlineTemplates": [{"sequence": "1","recipients": {"signers": [{"tabs": {"textTabs": null,"signHereTabs": null,"fullNameTabs": null,"dateSignedTabs": null},"signerRole": "Signer","routingOrder": "1","roleName": null,"recipientId": "1","name": "PuppySaturation","excludedDocuments": null,"email": "puppy.saturation@example.com"}]}],"document": {"name": "Contract","htmlDefinition": {"source": "<html>HTML markup to create a table data. This table data is dynamically generated on salesforce apex side, I verified the markup, It was clean and had no issues in it. The markup also has ds-signature data-ds-role='Signer' to match the signer role of 1st recipient</html>"},"documentId": "1","documentBase64": null},"compositeTemplateId": "1"}]}

解决方法

按照Larry K的方案修改document对象结构,将生成的HTML内容转为Base64编码后,通过documentBase64属性传递,同时指定fileExtension为html,修改后的document对象如下:

"document": {"name": "Contract","documentId": "1","documentBase64": <base64EncodedHTML>,"fileExtension" : "html"}

修改后问题得到解决。

内容的提问来源于stack exchange,提问作者PuppySaturation

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 02:27:46