DocuSign: how to enter pre-fill field value via python

Viewed 63

I'm working with python and the docusign_esign package. I've tried many of the solutions i've seen on the web and i'm not sure why but I cannot get any of them to work. It's important that these pre-filled fields are not editable by the signer. Each document sent out will have some variable fields so these pre-filled fields will need to be filled at the time of sending.

I'm trying to pre-fill the pre-fill text fields on my document and send it to the given email.

I'm getting a 400 error:b'{"errorCode":"REQUIRED_TAB_INCOMPLETE","message":"A Required field is incomplete. TabId: a53c008e-cbed-49d5-8ea5-150c7ecf4941"}'

My code:

     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

The pre-filled field is a text field with the label set to serviceAddress

1 Answers
Related