Hi,
I’m attempting to leverage the embedded URL function in the apex toolkit where a user can initiate a contract and have a user sign on their device in person using embedded URL to docusign.
I’m requesting an envelope using this code:
// 2. Create empty envelope tied to CPA
dfsle.Envelope env = dfsle.EnvelopeService.getEmptyEnvelope(
new dfsle.Entity(cpa.Id)
);
// 3. Attach DocuSign template
dfsle.Document doc = dfsle.Document.fromTemplate(
dfsle.UUID.parse(templateUuid),
'Customer Product Agreement'
);
env = env.withDocuments(new List<dfsle.Document>{ doc });
// 4. Create embedded recipient ( role name must match template role exactly)
dfsle.Recipient signer = dfsle.Recipient.newEmbeddedSigner(
cpa.Primary_Contact__r.Name,
cpa.Primary_Contact__r.Email,
String.valueOf(cpa.Primary_Contact__c) // clientUserId = Contact Id
).withRole(
new dfsle.Recipient.Role('Primary Contact', 1) // role name must match your template
);
env = env.withRecipients(new List<dfsle.Recipient>{ signer })
.withEmail('Please sign: ' + cpa.Name, '');
// 5. Send envelope (true = suppress email for embedded signing)
env = dfsle.EnvelopeService.sendEnvelope(env, true);
return String.valueOf(env.docuSignId);
And requesting URL with this code:
public static String getEmbeddedSigningUrl(String envId, String url) {
Url mySigningUrl = dfsle.SigningService.getEmbeddedSigningUrl(
dfsle.UUID.parse(envId), // envId value as a UUID
new URL(url) // url value as a URL
);
// Return string value of Url to controller
return mySigningUrl.toExternalForm();
The response when trying to request the URL:
Line: 315, Column: 1 |