ruby on rails - Docusign Not Generating Multiple Embedded Recipient Views -
i using docusign rest api, through gem rails. have 2 recipients, , need both of them sign document.
it should work this:
- generate envelope borrower(s) info passing envelope.
- display embedded document signing.
- return custom url/action
- if there signer, it should
- reload iframe
- ask second signers signature, same template signed
instead breaks when reloads iframe 2nd signer. generates envelope, second signer unique id, email etc. when create recipient view, returns nil.
how signer 1 sign, load second signer right after, custom fields filled both times?
def deliver(signing_borrower) client = docusignrest::client.new hashdata = { status: 'sent', template_id: my_id signers: [ { embedded: true, name: signing_borrower.name, email: signing_borrower_email, role_name: if (signing_borrower==borrower) 'borrower' else 'co-borrower' end } ] } generate_liabilities hashdata[:signers][0][:tabs] = if (signing_borrower==borrower) custom_fields else co_borrower_custom_fields end #if there coborrower, add data form second signer if co_borrower if signing_borrower==co_borrower opposite_of_signing_borrower = borrower else opposite_of_signing_borrower = co_borrower end borrower2= { name: opposite_of_signing_borrower.name, email: signing_borrower_email(opposite_of_signing_borrower), role_name: if (opposite_of_signing_borrower==co_borrower) 'co-borrower' else 'borrower' end } #add second borrower hash generate envelope form fields filled hashdata[:signers] << borrower2 hashdata[:signers][1][:tabs] = { texttabs: text_tabs, checkboxtabs: checkbox_tabs } end response = client.create_envelope_from_template hashdata self.envelope_id = response["envelopeid"] self.signing_url = docusignrest::client.new.get_recipient_view({ envelope_id: self.envelope_id, name: signing_borrower.name, email: signing_borrower_email(signing_borrower), return_url: return_url }) response end
the hashdata
{:status=>"sent", :email=> {:subject=>"application...", :body=>"please sign...."}, :template_id=>"xxxx-xxxx-xxxx", :signers=> [{:embedded=>true, :name=>"david l. testcase", :email=>"email@test.com", :role_name=>"borrower", :tabs=> {:texttabs=> [{:tablabel=>"phone", :name=>"phone", :value=>"717-717-7171"}] } }, {:name=>"marisol testcase", :email=>"email2@test.com", :role_name=>"co-borrower", :tabs=> {:texttabs=> [{:tablabel=>"phone", :name=>"phone", :value=>"717-717-7171"}] } }]}
you can accomplish you're trying making 3 api calls:
create envelope request, specifying both recipients 'embedded/captive' setting clientuserid property each recipient.
post recipient view request url launch first signer's signing session.
post recipient view request url launch second signer's signing session.
here's example json 3 calls.
1 - create envelope request
post https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctid}}/envelopes { "emailsubject": "please sign this", "emailblurb": "please sign...thanks!", "templateid": "064a7973-b7c1-41f3-a2ad-923ce8889333", "status": "sent", "templateroles": [ { "rolename": "borrower", "name": "john doe", "email": "johnsemail@outlook.com", "recipientid": "1", "clientuserid": "123", "tabs":{ "texttabs":[ { "tablabel":"borrowerphone", "value":"717-717-7171" }, ], } }, { "rolename": "co-borrower", "name": "jane doe", "email": "janesemail@outlook.com", "recipientid": "2", "clientuserid": "567", "tabs":{ "texttabs":[ { "tablabel":"co-borrowerphone", "value":"717-717-7171" }, ], } } ] }
a successful response contain id of newly created envelope.
2 - post recipient view (for first recipient)
make call when first signer ready sign. in request url, {{envelopeid}} envelope id value returned in response of create envelope request, , information in request body corresponds info submitted first recipient in create envelope request.
post https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctid}}/envelopes/{{envelopeid}}/views/recipient { "authenticationmethod": "email", "clientuserid": "123", "username": "john doe", "email": "johnsemail@outlook.com", "returnurl": "http://www.google.com" }
the response contain url can used launch docusign envelope first recipient.
3 - post recipient view (for second recipient)
make call when it's time second signer sign. in request url, {{envelopeid}} envelope id value returned in response of create envelope request, , information in request corresponds info submitted second recipient in create envelope request.
post https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctid}}/envelopes/{{envelopeid}}/views/recipient { "authenticationmethod": "email", "clientuserid": "567", "username": "jane doe", "email": "janesemail@outlook.com", "returnurl": "http://www.google.com" }
the response contain url can used launch docusign envelope second recipient.
Comments
Post a Comment