我想在嵌入式签名使用的模板文档上预填几个字段。我正在使用c#。我通过DocuSign模板向导添加了数据字段,想知道如何从c-sharp的嵌入式签名代码中预填充数据字段?在我的例子中,我向模板添加了一个出生日期和电话数据字段,并希望在提取文档进行签名时传递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,数据字段:标签:电话
需要知道我做错了什么。签名部分和其他一切工作正常。
答案 0 :(得分:0)
由于重复的问题而被投票,但这就是你要这样做的方式:
"tabs": {
"textTabs": [
{
"tabLabel": "Data Field 1",
"value": "Initial data goes here...",
"xPosition": "200",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1"
}]
}
答案 1 :(得分: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#请求中?让我知道。