DocuSign:如何通过python输入预填充字段值



我正在使用python和docusign_design包。我已经尝试了许多我在网上看到的解决方案,我不知道为什么,但我不能得到任何工作。重要的是,这些预先填写的字段不能被签名者编辑。发送出去的每个文档都有一些可变字段,所以这些预填写的字段需要在发送时填写。

我正试图在我的文档上预填充预填充文本字段,并将其发送到给定的电子邮件。

我得到一个400错误:b'{"errorCode":"REQUIRED_TAB_INCOMPLETE","message":"A Required field is incomplete. TabId: a53c008e-cbed-49d5-8ea5-150c7ecf4941"}'

我代码:

def create_and_send_envelope(
self, template_id, signer_email, signer_name, cc_email=None, cc_name=None):
envelope_definition = self.make_envelope_definition(
template_id, signer_email, signer_name
)
result = self.envelope_api.create_envelope(
self.account_id, envelope_definition=envelope_definition
)
return result

def make_envelope_definition(
self, template_id, signer_email, signer_name, cc_email=None, cc_name=None):
"""
Creates envelope
args -- parameters for the envelope:
signer_email, signer_name, signer_client_id
returns an envelope definition
"""
text_tab1 = Text(tab_label="serviceAddress", value="testValue")
prefill_tabs = PrefillTabs(text_tabs=[text_tab1])
tabs = Tabs(
PrefillTabs=prefill_tabs,
)
# Create the envelope definition
envelope_definition = EnvelopeDefinition(
status="sent",  # requests that the envelope be created and sent.
template_id=template_id,
tabs=tabs
)
# Create template role elements to connect the signer and cc recipients
# to the template
roles = []
signer = TemplateRole(
email=signer_email,
name=signer_name,
role_name='Customer',
)
roles.append(signer)
# Create a cc template role.
if cc_email and cc_name:
cc = TemplateRole(
email=cc_email,
name=cc_name,
role_name='cc')
roles.append(cc)
# Add the TemplateRole objects to the envelope object
envelope_definition.template_roles = roles
return envelope_definition

预填充字段是一个文本字段,标签设置为serviceAddress

这是一个通过API Request Builder的PreFill选项卡的实时示例。你可以将该工具的输出语言更改为Python sdk。

最新更新