0

使用 apex 工具包发送散装信封时遇到一些问题。如果我尝试使用带有预定义字段和 1 个收件人的 DocuSign 模板发送信封,则会出现错误 Dfsle.APIException:信封中不存在收件人 1。如果我从模板中删除收件人一切正常。有人可以帮忙吗?

public static Id buildListMethod(final Id SourceID){
       
       List<dfsle.Envelope> myBulkCopies = new List<dfsle.Envelope>();
       
       List<Opportunity> ContactInformation = [SELECT Id, 
                                               First_Name__c, 
                                               Last_Name__c, 
                                               Email__c, 
                                               Contact__c, 
                                               Contact__r.Name, 
                                               Start_Date__r.Name 
                                               FROM Opportunity 
                                               WHERE Start_Date__r.Id =:SourceId
                                               LIMIT 1];
       
       for (Opportunity opp : ContactInformation) 
       {
           myBulkCopies.add(dfsle.Envelope.newBulkCopy(dfsle.Recipient.fromSource
               (opp.First_Name__c + ' ' + opp.Last_Name__c, 
                opp.Email__c, 
                null, 
                'Signer 1', 
                new dfsle.Entity(opp.ID)))); // Source Salesforce object
          
       }
       
       // Create the bulk list. This list persists after sending and may be reused for multiple envelopes
       dfsle.BulkList myList = dfsle.BulkSendService.createLists(new List<dfsle.BulkList> {
           dfsle.BulkList.newList(
               'My bulk list', // List name
               myBulkCopies, // Envelope copies
               new dfsle.Entity(SourceID)) // The Salesforce source object
               })[0];
       
       // Save the ID for later operations
       Id myListId = myList.id;
       return myListId;
   }
   
   @future(callout=true)
   public static void sendBulkMethod(ID myListId, Id SourceID){ 
       
       String UUIDstr = '34faxxxx-xxxx-xxxx-xxxx-xxxxc3b2b0ca';
       String DocName = 'documentName';
       dfsle.UUID TempId = dfsle.UUID.parse(UUIDstr);
       dfsle.Document newDocument = dfsle.Document.fromTemplate(TempId, DocName);
       // Create a draft envelope with at least one dummy recipient.
       dfsle.Envelope myEnvelope = dfsle.BulkSendService.getDraftEnvelope(
           new List<dfsle.Document> { newDocument }, // Documents
           new dfsle.Entity(SourceID));  // Salesforce source entity
       // Send the envelope to your bulk send list.
       dfsle.BulkList.Result myResult = dfsle.BulkSendService.sendEnvelope(myListId, myEnvelope);  
   }
4

0 回答 0