Reputation: 1
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:
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
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