2017-07-03 61 views
-1

标签使用的模板

``code`  DocuSignTK.Recipient recipient = new DocuSignTK.Recipient(); 
 
     recipient.Email = signer_email; // This person will use embedded signing. If you have his 
 
      // email, supply it. If you don't, use a fake email that includes your 
 
      // ClientUserID. Eg embedded_signer_{ClientUserID}@your_company.com 
 
     recipient.UserName = signer_name; 
 
     recipient.ID = 1; 
 
     recipient.Type_x = 'Signer'; 
 
     recipient.RoutingOrder = 1; 
 
     recipient.RoleName = 'Signer1';   
 
     // We want this signer to be "captive" so we can use embedded signing with him 
 
     recipient.CaptiveInfo = new DocuSignTK.RecipientCaptiveInfo(); 
 
     recipient.CaptiveInfo.ClientUserID = signer_user_id; // Must uniquely identify the    
 

 
     // Create the recipient information   
 
     DocuSignTK.ArrayOfRecipient1 recipients = new DocuSignTK.ArrayOfRecipient1(); 
 
     recipients.Recipient = new DocuSignTK.Recipient[1]; 
 
     recipients.Recipient[0] = recipient; 
 
     
 
     DocuSignTK.ArrayOfTemplateReferenceRoleAssignment Roles = new DocuSignTK.ArrayOfTemplateReferenceRoleAssignment(); 
 
     Roles.RoleAssignment = new DocuSignTK.TemplateReferenceRoleAssignment[1]; 
 
     DocuSignTK.TemplateReferenceRoleAssignment role = new DocuSignTK.TemplateReferenceRoleAssignment(); 
 
     role.RoleName = 'Signer1'; 
 
     role.RecipientID = 1; 
 
     Roles.RoleAssignment[0] = role;   
 
     
 
     // Create the template reference from a server-side template ID 
 
     DocuSignTK.TemplateReference templateReference = new DocuSignTK.TemplateReference(); 
 
     templateReference.Template = 'd0d80082-612b-4a04-b2a1-0672eb720491'; 
 
     templateReference.TemplateLocation = 'Server'; 
 
     
 
     
 
     templateReference.RoleAssignments = Roles; 
 
     
 
     // Construct the envelope information 
 
     DocuSignTK.EnvelopeInformation envelopeInfo = new DocuSignTK.EnvelopeInformation(); 
 
     envelopeInfo.AccountId = account_Id; 
 
     envelopeInfo.Subject = 'Subject'; 
 
     envelopeInfo.EmailBlurb = 'Email content';   
 

 
     // Make the call 
 
     try { 
 
      //DocuSignTK.EnvelopeStatus result = api_sender.CreateAndSendEnvelope(envelope); 
 
      // Create draft with all the template information 
 
      DocuSignTK.ArrayOfTemplateReference TemplateReferenceArray = new DocuSignTK.ArrayOfTemplateReference(); 
 
      TemplateReferenceArray.TemplateReference = new DocuSignTK.TemplateReference[1]; 
 
      TemplateReferenceArray.TemplateReference[0] = templateReference; 
 
      DocuSignTK.EnvelopeStatus result = api_sender.CreateEnvelopeFromTemplates(TemplateReferenceArray, recipients, envelopeInfo, true); 
 
      envelope_id = result.EnvelopeID; 
 
      System.debug('Returned successfully, envelope_id = ' + envelope_id); 
 
     } catch (CalloutException e) { 
 
      System.debug('Exception - ' + e); 
 
      error_code = 'Problem: ' + e; 
 
      error_message = error_code; 
 
     } `code``

我整合的DocuSign嵌入式签名出现在文档的左上角嵌入签名。我正在使用SOAP API并使用方法CreateEnvelopeFromTemplates。我创建的模板有一些字段/选项卡。但是,一旦我打开签名url,这些字段位于文档的一侧,而不是我在模板中发送的位置。

我也为收件人分配了角色名称,但它不起作用。请帮忙。

Click here to see screenshot

+0

请向我们显示您的代码。 –

+0

由于您的代码可能未指定任何选项卡,因此您会看到DocuSign免费表单签名面板。 https://www.docusign.com/blog/quick-tip-tuesday-guided-signing-versus-free-form-signing/ –

+0

@CodingDawg - 感谢您的回复。我已经添加了上面的代码。我的假设是CreateEnvelopeFromTemplates将自动显示在模板上指定的选项卡。如果这种方法不这样做,那么我应该在哪里添加这些标签。我没有找到任何相关的代码。 – Rahul

回答

-1

我从网上下载制作一个模板,在沙箱上载,但一旦我在沙盒只有重新创建类似的模板,并使用它的代码模板ID则可以正常使用。显然,Docusign的导入模板实用程序似乎存在一些问题。

1

下面是C#代码来创建使用的DocuSign SOAP API从模板的信封。文档here

 string apiUrl = "https://demo.docusign.net/api/3.0/api.asmx"; 
     string accountId = "Enter accountId"; // 
     string email = "Enter email"; 
     string userName = "Enter intergrator key"; 

     userName += email; 
     string _password = "Enter password"; 
     var apiClient = new DocuSignTK.APIServiceSoapClient("APIServiceSoap", apiUrl); 
     apiClient.ClientCredentials.UserName.UserName = userName; 
     apiClient.ClientCredentials.UserName.Password = _password; 

     // Construct all the recipient information 
     var recipients = new DocuSignTK.Recipient[1]; 

     recipients[0] = new DocuSignTK.Recipient(); 
     recipients[0].Email = "[email protected]"; 
     recipients[0].UserName = "recipient one"; 
     recipients[0].Type = DocuSignTK.RecipientTypeCode.Signer; 
     recipients[0].ID = "1"; 
     recipients[0].RoutingOrder = 1; 
     recipients[0].RoleName = "Signer1"; 

     var roles = new DocuSignTK.TemplateReferenceRoleAssignment[1]; 
     roles[0] = new DocuSignTK.TemplateReferenceRoleAssignment(); 
     roles[0].RoleName = recipients[0].RoleName; 
     roles[0].RecipientID = recipients[0].ID; 

     // Use a server-side template -- you could make more than one of these 
     var templateReference = new DocuSignTK.TemplateReference(); 
     templateReference.TemplateLocation = DocuSignTK.TemplateLocationCode.Server; 
     // TODO: replace with template ID from your account 
     templateReference.Template = "d0d80082-612b-4a04-b2a1-0672eb720491"; 
     templateReference.RoleAssignments = roles; 

     // Construct the envelope information 
     DocuSignTK.EnvelopeInformation envelopeInfo = new DocuSignTK.EnvelopeInformation(); 
     envelopeInfo.AccountId = " "; 
     envelopeInfo.Subject = "create envelope from templates test"; 
     envelopeInfo.EmailBlurb = "testing docusign creation services"; 

     // Create draft with all the template information 
     DocuSignTK.EnvelopeStatus status = apiClient.CreateEnvelopeFromTemplates(new DocuSignTK.TemplateReference[] { templateReference }, 
      recipients, envelopeInfo, false);