3

我想在用于嵌入式签名的模板文档上预填一些字段。我正在使用 c#。我通过 DocuSign 模板向导添加了数据字段,想知道如何从 c-sharp 中嵌入的签名代码中预填充数据字段?在我的例子中,我在模板中添加了一个 Date Of Birth 和 Telephone Data 字段,并希望在提取文档进行签名时在我的 XML 中传递值。这是我所拥有的:

 string requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
            "<accountId>" + accountId + "</accountId>" +
            "<status>sent</status>" +
            "<emailSubject>Electronic Release of Information</emailSubject>" +
            "<emailBlurb>Please sign the release of information form</emailBlurb>" +
            "<templateId>" + System.Configuration.ConfigurationManager.AppSettings.Get("DocusignTempId") + "</templateId>" +
            "<templateRoles>" +
            "<templateRole>" +
            "<email>" + pUserEmail + "</email>" +   // NOTE: Use different email address if username provided in non-email format!
            "<name>" + pUserName + "</name>" + // username can be in email format or an actual ID string
            "<tabs>" +
            "<textTabs>" +
            "<textTab>" +
            "<tabLabel>DOB</tabLabel>" + 
            "<value>" + pDOB + "</value>" +
            "</textTab>" +
             "<textTab>" +
            "<tabLabel>Telephone</tabLabel>" +
            "<value>" + pTelephone + "</value>" +
            "</textTab>" +
            "</textTabs>" +
            "</tabs>" +
            "<roleName>Signer</roleName>" +
            "<clientUserId>1</clientUserId>" +
            "</templateRole>" +
            "</templateRoles>" +
            "</envelopeDefinition>";

在演示站点上,我在模板上创建了 2 个数据字段:数据字段:标签:DOB,数据字段:标签:电话

需要知道我做错了什么。签名部分和其他一切工作正常。

4

2 回答 2

0

由于重复的问题而被否决,但这就是你的做法:

"tabs": {
    "textTabs": [
    {
        "tabLabel": "Data Field 1",
        "value": "Initial data goes here...",
        "xPosition": "200",
        "yPosition": "200",
        "documentId": "1",
        "pageNumber": "1"
    }]
}
于 2013-07-19T06:17:48.677 回答
0

我有一些代码可以做到这一点,但它使用的是 JSON(不是 XML)。这里是:

        //
        // DocuSign Step 1. Login
        //
        , function(next) {
            var options = {
                "method": "GET"
                , "headers": {
                    "X-DocuSign-Authentication": dsAuthHeader
                    , "content-type": "application/json"
                    , "accept": "application/json"
                }
                , "uri": "https://demo.docusign.net/restapi/v2/login_information"
            };

            request(options, function(err, res, body) {
                console.log("Login Result: \r\n", JSON.parse(body))
                baseUrl = JSON.parse(body).loginAccounts[0].baseUrl;

                next(null);
            });

        }

        //
        // DocuSign Step 2. Request Signature From Template
        //
        , function(next) {
        var uri  = baseUrl + "/envelopes"
            , options = {
                "method": "POST"
                , "headers": {
                    "X-DocuSign-Authentication": dsAuthHeader
                    , "content-type": "application/json"
                    , "accept": "application/json"
                }
                , "uri": uri
                , "body" : JSON.stringify({
                    "emailSubject": "Patient Intake form from Human API"
                    , "templateId": templateId
                    , "templateRoles": [{
                        "email": humanEmail
                        , "name": humanName
                        , "roleName": templateRoleName
                        , "clientUserId": 1
                        , "tabs" : {
                            "textTabs" : [{
                                 tabLabel : "Email Address",
                                 value : humanEmail
                                }
                                , {
                                    tabLabel : "Name",
                                    value : humanName
                                }
                                , {
                                    tabLabel : "Height",
                                    value : height
                                }
                                , {
                                    tabLabel : "Weight",
                                    value : weight
                                }
                                ,{
                                    tabLabel : "Address 1",
                                    value : '1212 Victoria Lane'
                                }
                                ,{
                                    tabLabel : "Address 2",
                                    value : 'San Francisco, CA, 94109'
                                }

                            ]
                        }
                    }]
                    ,"status": "sent"
                })
            };

        request(options, function(err, res, body) {
            console.log("Request Envelope Result: \r\n", JSON.parse(body));
            next(null, body);
        })
    }

        //
        // DocuSign Step 3. Get Send View
        //
        , function(body, next) {
        var envelopeUri = JSON.parse(body).uri
            , options = {
                "method": "POST"
                , "headers": {
                    "X-DocuSign-Authentication": dsAuthHeader
                    , "content-type": "application/json"
                    , "accept": "application/json"
                }
                , "uri": baseUrl + envelopeUri + "/views/recipient"
                , "body": JSON.stringify({
                    "authenticationMethod": "email",
                    "email": humanEmail,
                    "returnUrl": "http://humanapi.co/",
                    "userName": humanName,
                    "clientUserId": "1"
                })
            };

        request(options, function(err, res, body) {
            console.log("Get Embedded View: \r\n", JSON.parse(body));
            response.render('docusign', { signing_url: JSON.parse(body).url });
        });
    }

我知道这不是您正在寻找的(C# + XML),但也许您可以获取此 JSON 并将其放入 C# 请求中?让我知道。

于 2013-07-19T21:31:28.447 回答