2017-02-20 6 views
0

У меня есть идентификатор учетной записи, а также идентификатор шаблона, но я получаю null в текстовых пользовательских и списках. Я использую метод REST api для DocuSign для getting custom fields and listed fields.Получить текстовое поле возвращает null в DocuSign

configureApiClient("https://demo.docusign.net/restapi"); 

// Step 1: Login() 
// call the Login() API which sets the user's baseUrl and returns their accountId 
AccountId = loginApi(username, password); 

TemplatesApi envelopesApi2 = new TemplatesApi(); 
CustomFields cfe = envelopesApi2.ListCustomFields(AccountId, templateId); 

Console.WriteLine("Get Custom Fields Information:\n{0}", 
          JsonConvert.SerializeObject(cfe)); 

Не могли бы вы помочь мне решить мою проблему?

Заранее спасибо

+0

использование DocuSign в REST API для этого –

+0

Что такое значение templateId вы определяете,? –

+0

Вы проверили свой аккаунт AccountId & templateId? –

ответ

-1

Пожалуйста, смотрите мой код ниже, чтобы создать пользовательское поле в шаблонах.

public EnvelopeSummary requestSignatureFromTemplateTest(DocuSignData data) 
    { 


     // instantiate api client with appropriate environment (for production change to www.docusign.net/restapi) 
     configureApiClient("https://demo.docusign.net/restapi"); 

     //=========================================================== 
     // Step 1: Login() 
     //=========================================================== 

     // call the Login() API which sets the user's baseUrl and returns their accountId 
     AccountId = loginApi(username, password); 

     //=========================================================== 
     // Step 2: Signature Request from Template 
     //=========================================================== 

     EnvelopeDefinition envDef = new EnvelopeDefinition(); 
     envDef.EmailSubject = "Please sign this sample template document11111111111"; 

     // assign recipient to template role by setting name, email, and role name. Note that the 
     // template role name must match the placeholder role name saved in your account template. 
     TemplateRole tRole = new TemplateRole(); 
     tRole.Email = recipientEmail; 
     tRole.Name = recipientName; 
     tRole.RoleName = templateRoleName; 

     List<TemplateRole> rolesList = new List<TemplateRole>() { tRole }; 

     // add the role to the envelope and assign valid templateId from your account 
     envDef.TemplateRoles = rolesList; 
     envDef.TemplateId = templateId; 

     // set envelope status to "sent" to immediately send the signature request 
     envDef.Status = "sent"; 


     List<TextCustomField> customFieldsTextList = new List<TextCustomField>(); 

     if (data.CustomFieldsText != null) 
     { 
      //custom text fields 
      foreach (DocuSignCustomField customField in data.CustomFieldsText) 
      { 
       TextCustomField newField = new TextCustomField(); 
       newField.Name = customField.Name; 
       newField.Value = customField.Value; 
       newField.Show = customField.Show; 
       newField.Required = customField.Required; 

       customFieldsTextList.Add(newField); 
      } 
     } 

     CustomFields customFields = new CustomFields(); 
     customFields.TextCustomFields = customFieldsTextList; 


     envDef.CustomFields = customFields; 


     // |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests) 
     EnvelopesApi envelopesApi = new EnvelopesApi(); 
     EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(AccountId, envDef); 

     // print the JSON response 
     //Console.WriteLine("Envelope Template Summary:\n{0}", JsonConvert.SerializeObject(envelopeSummary)); 

     return envelopeSummary; 

    } // end requestSignatureFromTemplateTest() 

этот код для получения пользовательских полей из шаблона

configureApiClient("https://demo.docusign.net/restapi"); 

// Шаг 1: Логин() // вызываем Логин() API, который устанавливает BaseUrl пользователя и возвращает их ACCOUNTID AccountId = loginApi (имя пользователя, пароль);

TemplatesApi envelopesApi2 = new TemplatesApi(); 
CustomFields cfe = envelopesApi2.ListCustomFields(AccountId, templateId); 
Console.WriteLine("Get Custom Fields Information:\n{0}", 
         JsonConvert.SerializeObject(cfe)); 
+0

Добро пожаловать в stackOverflow. Это было опубликовано как ответ, но он не пытается ответить на вопрос. Это должно быть редактирование, комментарий, другой вопрос или вообще исключить. –

0

Я вижу, что вы добавляете настраиваемые поля в конверт, а не в шаблон. Вы должны использовать EnvelopesApi для извлечения пользовательских полей. Вы неправильно используете TemplateId.

Используйте следующий код и передать envelopeId, который возвращается из envelopesApi.CreateEnvelope() вызова

var envelopesApi2 = new EnvelopesApi(); 
CustomFields cfe = envelopesApi2.ListCustomFields(AccountId, envelopeId); 
Console.WriteLine("Get Custom Fields Information:\n{0}", 
        JsonConvert.SerializeObject(cfe)); 
Смежные вопросы