So I am building a crm/docusign/crm integration. The flow is as follows:
- Salesperson clicks a button that takes them to a page on my server(scala play framework instance) that generates and sends the envelope for the document that the user can sign.
- Document is sent to user for signing.
- Once signed, Write the data back to the crm to each contact/lead/company, depending on field names mapped from docusign to the crm.
This is all working fine and dandy. Problem is, if there are more than 1 contact, they should all get the SAME docusign document and all be signers on it. I am not 100% sure this is even possible, or really why 2 of the same documents is an issue for the client, but it appears to be. The funky part about all of this is I CAN add more than 1 signer at the moment to the same envelope id, but the document is only editable by the first contact on the lead. Everyone else that gets it can't edit it. Once marked finished by the only person that can sign it, it just has their information on it for the other signers and is in read only mode still.
My question is is there any way this is possible? I am assuming that it isn't since each envelope id can really only relate to a single signer. It doesn't even make sense to me how a second signer could sign the same document with the same envelope id and put in different data and it maintain the integrity of both signers since envelope id seems to be a sort of session for the document. If anyone has any experience with the docusign API, I'd really appreciate some insight on this!
Code I'm using:
private def makeEnvelope(contacts: List[Contact], accountInfo: AccountInfo, leadId:Int, whichForm:FORMTYPE) = {
val env = new EnvelopeDefinition
val eventNotification = new EventNotification
eventNotification.setUrl(callbackURL) // fake var name for privacy
env.setTemplateId(templateId)
eventNotification.setRequireAcknowledgment("true")
eventNotification.setIncludeDocuments("true")
eventNotification.setLoggingEnabled("true")
var envelopeEvents : List[EnvelopeEvent]= List.empty[EnvelopeEvent]
val envelopeEvent = new EnvelopeEvent
envelopeEvent.setEnvelopeEventStatusCode("completed")
envelopeEvent.setIncludeDocuments("true")
envelopeEvents = envelopeEvent :: envelopeEvents
eventNotification.setEnvelopeEvents(envelopeEvents.asJava)
env.setEventNotification(eventNotification)
var signerList = List[TemplateRole]()
for(contact <- contacts) {
val signer1 = new TemplateRole
val signEmail = contact.email
signer1.setEmail(signEmail)
signer1.setName(contact.fullName)
signer1.setRoleName("Signatory")
val showAddress: Boolean = contacts.length == 1
// tabs is some data from crm to map to prepopulate docusign when user signs form
val tabs = populateFormData(accountInfo, contact, whichForm, showAddress)
signer1.setTabs(tabs)
signerList = signer1 :: signerList
}
env.setTemplateRoles(signerList.asJava)
env.setStatus("sent")
env
}