首页 > 解决方案 > 当我创建带有字段的文档模板时,如果我使用 API 将其发送给其他人,字段会消失吗?

问题描述

ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
        List<string> scopes = new List<string>
        {
            OAuth.Scope_SIGNATURE,
            OAuth.Scope_IMPERSONATION
        };
        docuSign_JWT testConfig = new docuSign_JWT();
        testConfig.ApiClient = new ApiClient(testConfig.Host);

        // If this is the first time logging in - Get Consent from the user - this is a onetime step.
        Uri oauthURI = testConfig.ApiClient.GetAuthorizationUri(testConfig.IntegratorKey, scopes, RedirectURI, OAuth.CODE, "testState");
        Process.Start(oauthURI.ToString());
        var privateKeyStream = System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(testConfig.PrivateKeyFilename));
        OAuth.OAuthToken tokenInfo = testConfig.ApiClient.RequestJWTUserToken(testConfig.IntegratorKey, testConfig.UserId, testConfig.OAuthBasePath, privateKeyStream, testConfig.ExpiresInHours);
        apiClient = new ApiClient("https://demo.docusign.net/restapi");
        apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + tokenInfo.access_token);

        EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition();
        envelopeDefinition.EmailSubject = "Please sign this document";
        envelopeDefinition.TemplateId = "***************";

        DocuSign.eSign.Model.TemplateRole cc1 = new DocuSign.eSign.Model.TemplateRole();
        cc1.Email = "Email1 default template recipient";
        cc1.Name = "Name";
        cc1.RoleName = "Staff";

        DocuSign.eSign.Model.TemplateRole cc2 = new DocuSign.eSign.Model.TemplateRole();
        cc2.Email = "Email2 new email ID";
        cc2.Name = "Name2";
        cc2.RoleName = "Staff";

        DocuSign.eSign.Model.TemplateRole cc3 = new DocuSign.eSign.Model.TemplateRole();
        cc3.Email = "Email3 new Email ID";
        cc3.Name = "Name3";
        cc3.RoleName = "Staff";

       
        List<DocuSign.eSign.Model.TemplateRole> templateRoles = new List<DocuSign.eSign.Model.TemplateRole>();    
        templateRoles.Add(cc1);
        templateRoles.Add(cc2);
        templateRoles.Add(cc3);

        envelopeDefinition.TemplateRoles = templateRoles;
        envelopeDefinition.Status = "sent";

        EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
        EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(ConfigurationManager.AppSettings["accountID"], envelopeDefinition);

以上是我发送docuSign模板文档的代码。但只有默认收件人获得带字段的文档,其他收件人仅获得不带字段的 pdf 文件。如何将带有字段的模板文档发送给所有收件人。下面是模板字段 img 谢谢

在此处输入图像描述

标签: asp.netapitemplatesdocusignapi

解决方案


看起来您的所有三个收件人都具有相同的RoleName,这意味着将每个收件人映射到他们的角色会有一个问题。

模板角色名称应该是唯一的,并且它们在 API 调用中的定义需要与模板中存在的内容完全匹配。设置要通过 API 填充的角色时,确保填写 RoleName 字段也很重要。如果模板具有“刻录”名称和电子邮件地址,您将无法在 API 调用中填充它们。

您能否截取有关如何在 Web 控制台中的模板上设置收件人的屏幕截图?像这样:模板角色示例


推荐阅读