kingbak
kingbak

Reputation: 1

Same recipientId assigned to multiple signature tags

Here is my scenario:

In Salesforce, I have an Opportunity that can be related to multiple Opportunity Documents (custom object). There are three Opportunity Documents: Non-Disclosure Agreement, Contract, and Onboarding Policy Agreement. We created Gen templates for each of these.

Each document may have a different person that needs to sign. For example, Bob may need to sign the Non-Disclosure Agreement and Contract while Alice needs to sign the Onboarding Policy Agreement. As such, we have a "Signer" field captured on Onboarding Document.

Lastly, there could be multiple of one document on an Opportunity that needs to be signed. For instance, we may have two copies of a Non-Disclosure Agreement that needs signature for one opportunity.

Our thinking is that we could create an LWC that leverages the apex toolkit to allow a user to, at any point, select one or more Opportunity Documents and then click a button called Generate Envelope. Using the Bob/Alice example above, the LWC (referencing the apex toolkit) would:

  1. Create an envelope
  2. See that the signers for all the documents are Bob and Alice, and therefore create a recipient for Bob and a recipient for Alice.
  3. Generate each document using the corresponding gen template 3a. For each document, grab the Signer and set its signature tag to the appropriate recipient. (ex: Bob is the Signer for Non-Disclosure Agreement, so Bob's recipientId would be set to the signature tag in the Non-Disclosure Agreement. Alice is the Signer for Onboarding Policy Agreement, so Alice's recipientId would be set to the signature tag in the Onboarding Policy Agreement. Bob is the Signer for Contract, so Bob's recipientId would be set to the signature tag in the Contract).
  4. Redirect user to sender view so they can review everything before actually sending.

Here is what I don't want: I don't want Bob to be two recipients in this scenario. I want Bob to be one recipient that gets tied to the signature tags for two documents so he only gets one email and can provide all his signatures in that one email.

Is this possible using the apex toolkit?

I know this is going to require the apex toolkit because this scenario is much more dynamic than what the Salesforce Docusign package provides out of the box.

Upvotes: 0

Views: 55

Answers (1)

jc_docusign
jc_docusign

Reputation: 11

Quick answer: Yes, this can be done with the Apex Toolkit. On the Recipient class, you can use the method withRole. This will allow to set the role name, and more importantly, the role ordinal. The second parameter allows to differentiate the signers (ie. Signer 1, Signer 2, etc). That way signature for Bob will be shown only for Bob to sign, and signatures for Alice will only be shown for Alice to sign.

For the sender view, you will utilize the getSenderViewUrl method on the EnvelopeService class. This method will return a Docusign URL that will embed a sending session.

Docusign provides a code example for embedded signing; however, this can be updated with the getSenderViewUrl to achieve the desired result.

Upvotes: 1

Related Questions