Skip to main content
Solved

Template with variable number of signers

  • December 20, 2024
  • 3 replies
  • 62 views

Forum|alt.badge.img+2

Hello all,

 

I have a template where I have defined four signers, in the following way:

 


I want to create envelopes out of this template using the Python SDK. Sometimes, I wanna add all four signers to an envelope, but sometimes I need to only add a subset of the signers (only signer1, signer1 and signer2, and so on). I have accomplished that in the following way:

 

        signer1 = TemplateRole(  # The signer

            email="<email>", name="Signer 1",

            role_name="signer_1_primary",

            tabs=tabs

        )

        

        signer2 = TemplateRole(  # The signer

            email="<email>", name="Signer 2",

            role_name="signer_2",

            tabs=tabs

        )

        

        signer3 = TemplateRole(  # The signer

            email="<email>", name="Signer 3",

            role_name="signer_3",

            tabs=tabs

        )

        

        signer4 = TemplateRole(  # The signer

            email="<email>", name="Signer 4",

            role_name="signer_4",

        )

        envelope_definition = EnvelopeDefinition(

            status="sent",  # requests that the envelope be created and sent.

            template_id=template_id,

            template_roles=[

                signer1, 

                signer2, 

                signer4

            ],

        )

        

        results = envelopes_api.create_envelope(

            account_id=account_id,                   envelope_definition=envelope_definition

        )

 

 

However, if I do this instead:

 

       signer1 = TemplateRole(  # The signer

            email="<email>", name="Signer 1",

            role_name="signer_1_primary",

            tabs=tabs

        )

        

        signer2 = TemplateRole(  # The signer

            email="<email>", name="Signer 2",

            role_name="signer_2",

            tabs=tabs

        )

        

        signer3 = TemplateRole(  # The signer

            email="<email>", name="Signer 3",

            role_name="signer_3",

            tabs=tabs

        )

        

        signer4 = TemplateRole(  # The signer

            email="<email>", name="Signer 4",

            role_name="signer_4",

        )

        envelope_definition = EnvelopeDefinition(

            status="created",  # requests that the envelope be created and not sent.

            template_id=template_id,

            template_roles=[

                signer1, 

                signer2, 

                # signer3, 

                signer4

            ],

        )

        

        results = envelopes_api.create_envelope(

            account_id=account_id, envelope_definition=envelope_definition

        )

        

        envelope_id = results.envelope_id

        

        send_envelope_req = Envelope(status="sent")

        envelope = envelopes_api.update(

            account_id,

            str(envelope_id), 

            envelope=send_envelope_req

        )

 

 

Then I get an error.

The difference is that in the second example, I created the envelope with status “created” and tried to edit it later to “sent”. When I try that, I get the following error:

 

b'{"errorCode":"INVALID_EMAIL_ADDRESS_FOR_RECIPIENT","message":"The email address for the recipient is invalid. The recipient Id follows."}'

 

It only lets me edit the envelope if I provide all the four signers.

Could anyone help me with this?

 

 

 

Best answer by Alexandre.Augusto

Hello, ​@aporto 

 

In you scenario you need to delete the signers without name and email addresses.

When using a template to generate an envelope, your template has four placeholders or recipients. Those not being filled out shoud be deleted before you be able to send such envelope, so in your code check first for empty name/email address values then delete it so you be able to proceed.

 

If you think this was useful, I’d appreciate your Like here.

 

Best,

Alexandre

View Original
Is this content helpful?

3 replies

Alexandre.Augusto
Docusign Employee
Forum|alt.badge.img+14

Hello, ​@aporto 

 

In you scenario you need to delete the signers without name and email addresses.

When using a template to generate an envelope, your template has four placeholders or recipients. Those not being filled out shoud be deleted before you be able to send such envelope, so in your code check first for empty name/email address values then delete it so you be able to proceed.

 

If you think this was useful, I’d appreciate your Like here.

 

Best,

Alexandre


Forum|alt.badge.img+2
  • Author
  • Newcomer
  • 3 replies
  • December 23, 2024

Hi ​@Alexandre.Augusto ,

 

Thanks for the answer, but it was not clear to me how to delete the signers. Could you please elaborate it further? I would like to do it using the Python SDK.


JohnSantos
Valued Contributor
Forum|alt.badge.img+18
  • Valued Contributor
  • 985 replies
  • December 23, 2024

@aporto 

The short answer is that DocuSign requires all “placeholder” recipients (i.e., the roles defined in your template) to be resolved in some way before you can send the envelope. When you create the envelope in a draft (a.k.a. "status" = "created") state, DocuSign enforces that all template roles are properly satisfied or removed before sending. By contrast, if you do a single-step "status" = "sent" envelope creation, DocuSign is more lenient with skipping placeholder recipients that are never populated.