1
votes

I am using the C# DocuSign library and I am sending 2 documents in the envelope.
I am adding 2 recipients.

The first recipient must sign document 1 so the SignHere class has DocumentId set to 1. The second recipient must sign document 2 so the SignHere class has DocumentId set to 2.

What happens is that both recipients get asked to sign document 1 and document 2 and the signatures overwrite each other.

So the DocumentId in the SignHere class is being ignored. This seems like a bug.

It seems like the anchor string is the only thing really controlling who signs what document and both documents are going to have anchor strings that are the same. This is because the documents will have been pre-built with anchor strings like <<<signhere:1>>>

I have edited this to show my code:

public string SendDocument(
   DocuSignDocument[] Documents,
   DocuSignRecipient[] Recipients,
   DocuSignSignature[] Signatures,
   string EmailSubject = null)
{
   string AccessToken = GetAccessToken();

   List<Document> EnvelopeDocuments = new List<Document>();

   int Index = 0;

   foreach (DocuSignDocument Doc in Documents)
   {
       Document Document = new Document
       {
           DocumentBase64 = Convert.ToBase64String(FileToBytes(Doc.FileName)),
           Name = Doc.DocumentName,
           FileExtension = Path.GetExtension(Doc.FileName).TrimStart('.'),
           DocumentId = (Index + 1).ToString()
       };

       EnvelopeDocuments.Add(Document);

       Index++;
   }

   List<Signer> Signers = new List<Signer>();

   List<SignHere> SignTabs;

   Index = 0;

   foreach (DocuSignRecipient Recipient in Recipients)
   {
       Signer Signer = new Signer()
       {
           Email = Recipient.EmailAddress,
           Name = Recipient.Name,
           RecipientId = (Index + 1).ToString(),
           RoutingOrder = (Index + 1).ToString()
           //RoutingOrder = "1"
       };

       SignTabs = new List<SignHere>();

       // Set the signatures needed for this recipient
       foreach (DocuSignSignature Sig in Signatures)
       {
           if (Sig.DocumentIndex < 0 || Sig.DocumentIndex > Documents.Length - 1)
               throw new Exception("Invalid signature DocumentIndex");

           if (Sig.RecipientIndex < 0 || Sig.RecipientIndex > Recipients.Length - 1)
               throw new Exception("Invalid signature RecipientIndex");

           if (Sig.RecipientIndex == Index)
           {
               // Signature is for this recipient
               SignHere SignHere = new SignHere()
               {
                   // It seems DocumentId here is ignored because this recipient still gets asked to sign both documents
                   DocumentId = (Sig.DocumentIndex + 1).ToString(),
                   RecipientId = (Sig.RecipientIndex + 1).ToString(),
                   TabLabel = "Sign here for " + Recipient.Name,
                   AnchorString = "<<<signhere:" + (Sig.DocumentSignatureIndex + 1) + ">>>"
               };

               SignTabs.Add(SignHere);
           }
       }

       Signer.Tabs = new Tabs() { SignHereTabs = SignTabs };

       Signers.Add(Signer);

       Index++;
   }

   if (EmailSubject == null)
       EmailSubject = "Please sign the document";

   EnvelopeDefinition Envelope = new EnvelopeDefinition
   {
       EmailSubject = EmailSubject,
       Documents = EnvelopeDocuments,
       Recipients = new Recipients { Signers = Signers },
       Status = "sent"
   };


   ApiClient Client = new ApiClient(ApiAddress);

   Client.Configuration.AddDefaultHeader("Authorization", "Bearer " + AccessToken);

   EnvelopesApi EnvelopesApi = new EnvelopesApi(Client.Configuration);

   EnvelopeSummary Results = EnvelopesApi.CreateEnvelope(_AccountId, Envelope);

   return Results.EnvelopeId;
1
If you share your code - that would help. Are the recipients embedded or remote?Inbar Gazit
the way you assign tabs is based on the recipients, not based on document. You can still do what you want, but first have to ensure you have the correct RecipientIdInbar Gazit
I have edited my original post above to show some codeuser2882190
ok, now I know it's about anchorString, so I posted an answer belowInbar Gazit

1 Answers

1
votes

There is a setting at an account level for your DS Account for anchor String population scope, by default it is Envelope scope. So if same anchor string is present on both the documents in the envelope then DocuSign will apply tabs for each signer on each document. To fix this, you need to ask DocuSign Support or your DocuSign's Account Manager to change the scope to Document instead of Envelope from DocuSign's backend Internal Admin tool.

Once scope is set to Document then you can add documentId alongwith the anchorString for each String, and it will apply tab for that specific signer only.

Also please note, backend Internal Admin will show the Anchor Population scope as Document (which is a UI bug) but it is actually Envelope. So ask DS person who you are working with to toggle that scope twice, first to Envelope and then back to Document scope.