I am sending an envelope using the Send to Docusign button, but i am getting an error
Invalid envelope.Email address is undefined.
Please find the below code which i have written on the Docusign Button
{!URLFOR("/apex/dsfs__DocuSign_CreateEnvelope", null,[SourceID = Authority_Granting__c.Id,
DST = $Label.Docusign_Template,
CCRM = "Decision Maker - Signer 1",
CCTM = "Decision Make",
CRL = "Email~"+ Authority_Granting__c.OwnerEmail+";FirstName~"+ Authority_Granting__c.Name +";LastName~" + Authority_Granting__c.Name + ";Role~Signer_1,RoutingOrder~1",
LA = '0',
LF = '0'])
}
You need to ensure that the Authority_Granting__c.OwnerEmail is a good email address.
To debug:
Does the button ever work? Or never works?
Check the API log on DocuSign to see exactly what is being sent to create the envelope. See https://support.docusign.com/en/guides/ndse-user-guide-api-request-logging
As a test, try setting the button to check that the rest of your button is working as expected.
CRL = "Email~"+ "your_email#your_domain.com" +";FirstName~"+ Authority_Granting__c.Name +";LastName~" + Authority_Granting__c.Name + ";Role~Signer_1,RoutingOrder~1",
Related
I have integrated DocuSign embedded signing into my web app, which is still in development so using DocuSign developer sandbox.
When an envelope is created programmatically, I am including Name, Email and ClientUserId for the signer like this:
var signers = new List<TemplateRole>();
foreach (var r in req.Recipients)
{
var signer = new TemplateRole();
signer.ClientUserId = r.SSOUserId;
signer.Email = r.Email;
signer.Name = r.Name;
signer.RoleName = r.RoleName;
signer.RoutingOrder = r.RoutingOrder.ToString();
signer.Tabs = r.MergeFields
signers.Add(signer);
}
var env = new EnvelopeDefinition()
{
TemplateId = ...,
TemplateRoles = new List<TemplateRole>(signers),
EventNotification = ...,
Status = "Sent"
};
When an embedded recipient view is requested, I include the same exact Name, Email and ClientUserId in the request like this:
var envelopeApi = new EnvelopesApi(ApiClient);
var viewOptions = new RecipientViewRequest
{
ReturnUrl = ...,
AuthenticationMethod = "Password",
ClientUserId = recipient.SSOUserId,
UserName = recipient.Name,
Email = recipient.Email
};
var viewUrl = envelopeApi.CreateRecipientView(AccountId, DocuSignEnvelopeId, viewOptions);
Even though the user may change their Name and/or Email in my app, I have the original values saved in a table and I use those original values when requesting the view from DocuSign. This setup has worked 100% of the time for many months until now when an envelope is having trouble obtaining a recipient view. The envelope was created + viewed last week (April 27, 2022), and when the user tried to sign it today (May 4, 2022), they keep getting this error:
DocuSign.eSign.Client.ApiException: Error calling CreateRecipientView: {
"errorCode":"UNKNOWN_ENVELOPE_RECIPIENT",
"message":"The recipient you have identified is not a valid recipient of the specified envelope."
}
Note that hundreds of envelopes created before and after the above envelope are still able to obtain a recipient view with the exact same code + configuration. The problematic envelope has not expired, I can still see it in the Waiting for Others section of the DocuSign admin site. I have compared its recipient info at DocuSign (by invoking ListRecipients) with the info I have in my database, and the Name, Email, ClientUserId, RoleName, RoutingOrder all match completely. My account is set up to expire envelopes after 120 days, and I am not doing anything during envelope creation to set an expiration date. I have seen many others having this issue but typically their problem is the ClientUserId. My code has that handled, and it works for every other envelope.
The only difference I have seen between this envelope and the others is that ListRecipients results show the affected envelope as having a property
"signatureInfo": {
"fontStyle": "docusign7",
"signatureInitials": "RW",
"signatureName": "Test"
}
that is null for all other envelopes. The documentation states that this property can be set by the sender to pre-fill signature fields. However, I didn't even know about this property before today, so my app has never set it. It would be weird for this property to cause the envelope to be in a state where it cannot be signed anymore but I am struggling to find a reason why this particular envelope cannot be signed. Btw, the signatureName of Test actually matches the Name property of the recipient so its even more confusing why DocuSign is refusing to recognize the signer.
If the envelope is still active, I suggest doing a Recipients:list operation. Also check that the recipient is a "current" recipient. (If there's only one recipient, then this doesn't apply.)
If the Recipients:list doesn't give you any clues then I suggest you contact developer support. They can check our backend logs to see if there's additional information on why the RecipientsView call didn't work.
See page https://support.docusign.com/s/contactSupport?language=en_US First login to that page if you have a production account. You can get support if you only have a developer account.
We are using DocuSign Apex Toolkit to generate & wned a DocuSign envelope whenever a new record is created and storing the envelope ID on the parent record. We have a lightning component on which we want to display the Envelope as an Iframe. We are using DocuSign "getSigningUrl" & "getEmbeddedSigningUrl" methods. The former one returns "null" & later one is giving error as "The recipient you have identified is not a valid recipient of the specified envelope.". Please suggest.
using embedded method
Url retUrl = new Url('[sfdc base url]');
String envelopeID = 'B33EBEFD-A64F-4D86-9034-6700AFB22EEE';
dfsle.UUID uid = dfsle.UUID.parse(envelopeID);
Url u = dfsle.SigningService.getEmbeddedSigningUrl(uid,retUrl);
System.debug('u---->'+u);
usign signing url method
String envelopeID = 'a271h000000L55d';
dfsle.Envelope e = dfsle.EnvelopeService.getEnvelope(envelopeID);
System.debug('e---->'+e);
Url retUrl = new Url('[sfdc base url]');
Url u = dfsle.SigningService.getSigningUrl(e,retUrl,true );
System.debug('u---->'+u);
You have to ensure:
The envelope is sent. It is not in "draft" state and is not in any other state (like Completed or Void)
The userID for the signer is the correct email/name combination for the recipient for this envelope.
Your envelopeID is valid. In your second code your envelope is not a GUID. EnvelopeID is always a GUID.
I've setup a developer sandbox environment of DocuSign. Using its C#.NET API Client, I want to send a document for signing to client's more than one personal email ids. Once the client opens any email to see and sign it, the corresponding DocuSign envelope state should get updated to Completed.
Also, I tried to achieve the above behavior through multiple signer recipients, but the envelope state gets marked completed, when all the signer recipients sign the document. Here I want any signer recipient sign should be enough to complete the document signing workflow.
Please suggest how to get it done
Regards,
A
In order to deliver an envelope to several emails in a single role, you'll need to create a Signing Group. Signing Groups can be created and managed through the API, so you'll be able to do that programatically.
While you'll need to implement your own business logic and error checking, a sample of creating a Signing Group in c# looks like:
SigningGroup signingGroup = new SigningGroup();
signingGroup.GroupName = "SigningGroup_" + DateTime.UtcNow.Ticks.ToString();
signingGroup.GroupType = "sharedSigningGroup";
signingGroup.Users = new List<SigningGroupUser>();
SigningGroupUser signingGroupUser1 = new SigningGroupUser();
signingGroupUser1.UserName = "Example Signer";
signingGroupUser1.Email = "signer#example.com";
signingGroup.Users.Add(signingGroupUser1);
SigningGroupUser signingGroupUser2 = new SigningGroupUser();
signingGroupUser2.UserName = "Example Signer";
signingGroupUser2.Email = "personal.email#example.com";
signingGroup.Users.Add(signingGroupUser2);
SigningGroupInformation signingGroupInformation = new SigningGroupInformation();
signingGroupInformation.Groups = new List<SigningGroup> { signingGroup };
SigningGroupsApi signingGroupsApi = new SigningGroupsApi(apiClient.Configuration);
SigningGroupInformation newGroupInfo = signingGroupsApi.CreateList(accountId, signingGroupInformation);
string newGroupId = newGroupInfo.Groups[0].SigningGroupId;
To use the Signing Group in an envelope, define a signer with that group ID:
Signer signer = new Signer
{
SigningGroupId = newGroupId,
RecipientId = "1",
RoutingOrder = "1"
};
Once the envelope is created as a draft, you can then clean up the signing group:
signingGroupsApi.DeleteList(accountId, newGroupInfo);
I have this thing working for like 2 years. Then it stopped sending emails to the signers after they signed a document. By the way the document is created from a widget embedded method.
I'm using the PHP SDK of the docusign API. And here's a summary of my code
$envelopeApi = new \DocuSign\eSign\Api\EnvelopesApi($apiClient);
$document = new \DocuSign\eSign\Model\Document();
$document->setDocumentBase64("My document template");
$document->setName("My template name);
$document->setDocumentId("randomly generated document ID");
// creates the sign here
$signHere = new \DocuSign\eSign\Model\SignHere();
$signHere->setAnchorString("Signature:");
$signHere->setAnchorIgnoreIfNotPresent("false");
$signHere->setAnchorUnits("pixels");
$signHere->setAnchorYOffset("50");
$signHere->setAnchorXOffset("5");
$signHere->setDocumentId("The document ID");
$signHere->setRecipientId("The recipient ID, randomly generated");
// add the signature tab to the envelope's list of tabs
$tabs = new \DocuSign\eSign\Model\Tabs();
$tabs->setSignHereTabs(array($signHere));
// add the signer to the envelope
$signer = new \DocuSign\eSign\Model\Signer();
$signer->setName("Recipient Name");
$signer->setEmail("Recipient Email");
$signer->setRecipientId("The recipient ID");
$signer->setTabs($tabs);
$signer->setClientUserId("The client user ID");
// Add a recipient to sign the document
$recipients = new \DocuSign\eSign\Model\Recipients();
$recipients->setSigners(array($signer));
$envelop_definition = new \DocuSign\eSign\Model\EnvelopeDefinition();
$envelop_definition->setEmailSubject("Mail subject");
// set envelope status to "sent" to immediately send the signature request
$envelop_definition->setStatus("sent");
$envelop_definition->setRecipients($recipients);
$envelop_definition->setDocuments(array($document));
// create and send the envelope! (aka signature request)
$envelopeApi->createEnvelope("Owner account ID", $envelop_definition, null);
I knew that by adding the envelope definition status "sent" would send a copy to the signer but thats not the case. Did something happened recently on the API that I have to adapt? I checked the documentation but still the same. So I'm not sure if I'm doing the right thing.
Any help would be greatly appreciated. Thanks in advance.
By setting a ClientUserId for your signer, you are creating a Captive Recipient. If you want DocuSign to do email delivery, remove the ClientUserId parameter and a Remote Recipient will be created instead.
I am using the code from the Code Recipes for Embedded signing but converted from C# to VB.NET, the code uses the Docusign API Nuget.
The CreateEnvelope returns a USER_LACKS_PERMISSIONS.
I have gone through my permissions and checked everything. The user I am logging in with is an Account Administrator and seems to have all permissions checked.
I am setting the Recipient Email to the actual recipient email (different from my administrator account) even though it's embedded signing, I don't know if that is the problem. I do want the actual signer to get a copy of the signed document which is why I am using the recipient email as the RecipientEmail.
Below is the code that causes the error:
Dim accountId As String
accountId = loginApi()
Dim envDef As New DocuSign.eSign.Model.EnvelopeDefinition()
envDef.EmailSubject = "TEST - Please sign this doc"
' Add a document to the envelope
Dim doc As New DocuSign.eSign.Model.Document()
doc.DocumentBase64 = System.Convert.ToBase64String(DocumentBytes)
doc.Name = "TestFile.pdf"
doc.DocumentId = "1"
envDef.Documents = New List(Of DocuSign.eSign.Model.Document)()
envDef.Documents.Add(doc)
' Add a recipient to sign the documeent
Dim signer As New DocuSign.eSign.Model.Signer()
signer.Email = recipientEmail
signer.Name = recipientName
signer.RecipientId = "1"
signer.ClientUserId = "1234"
' must set |clientUserId| to embed the recipient!
' Create a |SignHere| tab somewhere on the document for the recipient to sign
signer.Tabs = New DocuSign.eSign.Model.Tabs()
signer.Tabs.SignHereTabs = New List(Of DocuSign.eSign.Model.SignHere)()
Dim signHere As New DocuSign.eSign.Model.SignHere()
signHere.DocumentId = "1"
signHere.PageNumber = "1"
signHere.RecipientId = "1"
signHere.XPosition = "100"
signHere.YPosition = "100"
signer.Tabs.SignHereTabs.Add(signHere)
envDef.Recipients = New DocuSign.eSign.Model.Recipients()
envDef.Recipients.Signers = New List(Of DocuSign.eSign.Model.Signer)()
envDef.Recipients.Signers.Add(signer)
' set envelope status to "sent" to immediately send the signature request
envDef.Status = "sent"
' |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
Dim envelopesApi As New DocuSign.eSign.Api.EnvelopesApi()
Dim envelopeSummary As DocuSign.eSign.Model.EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef)
These are the permissions:
The first issue when diagnosing a problem like this is to figure out if it is a credentials (permissions) problem or something else.
There's an easy test for to see if the user name is set up right:
Run the Recipe tester. You can quickly run it for free on Heroku. See the "Deploy on Heroku" button. Choose the Embedded Signing recipe. If it works with your user demo sandbox email/password then you know that the problem lies somewhere in your code.
You can use the tool to authenticate using either OAuth or DocuSign Legacy authentication (Service Integration authentication.)
Next, use the tester's API log feature to see the API calls of your VB program. Compare the DocuSign API requests that your program is making vs the requests from the Recipe tester.
The heroku app used a post that goes to:
https://demo.docusign.net:7802/restapi/v2/accounts/13193/envelopes
Whereas my visual studio app uses the production url:
https://www.docusign.net/restapi
All this time I was checking the permissions of the user in demo.docusign.net
But it turns out ANOTHER USER WITH THE SAME EMAIL and password existed in production (www.docusign.net)
The production account did not have the correct permissions.
The fact that the DocuSign app showed me the "Select User" page first, showing two identical entries was the clue that TWO ACCOUNTS EXIST: one in production and one in demo.
It would be nice if in the "Select User" page, DocuSign listed the BASE URL as well, or a column showing Production or Demo.