Reputation: 333
I created a template by the UI, and use it to create envelopes through the rest API. So far so good.
In the template, 4 roles were created. But one of these should be optional when creating the envelope, that is, in certain envelopes there will only be 3 signers.
The problem is that if I only send information for 3 templatesroles the docusign returns an error of INVALID_EMAIL_ADDRESS_FOR_RECIPIENT, for the role that was not informed.
My question is if there is a way to create a "optional" role in template. Which will only be informed in some envelopes.
Edit:
I'm creating the envelope with the status "created". I do that bc we have to add some documents to the envelope before sending. After that I update the envelope changing the status to "sent".
The error happens when I update the status to "sent". If I create the envelope already with the "sent" status the error doesn't happens.
Here's my code:
$result = Docusign::createEnvelope(array(
'templateId' => $saleContract->obra->template_id,
'emailSubject' => 'Contrato de Compra - ' . $saleContract->obra->nome_fantasia,
'status' => 'created',
'templateRoles' => $this->getRoles($saleContract, $tabs),
));
$this->addDocuments($saleContract, $result['envelopeId']);
//HERE IS WHERE THE ERROR HAPPENS
Docusign::updateEnvelope($result['envelopeId'], ['status' => 'sent']);
Upvotes: 2
Views: 797
Reputation: 908
By default, template roles are optional. This means that you can successfully do the following:
Any Recipient Roles that you do not specify information for when you POST /envelopes will not be included. In the event you want to create your envelope in draft, make modifications, and then send, set the "merge roles on draft" qp to true.
merge_roles_on_draft string
When set to true, template roles will be merged, and empty recipients will be removed. This parameter applies when you create a draft envelope with multiple templates. (To create a draft envelope, the status field is set to created.)
If you're still having problems, double-check that you haven't prepopulated your template role with name or email values. That will fudge up the merge ^
Upvotes: 4