使用自定义字段创建DocuSign信封

时间:2014-08-12 00:38:01

标签: json docusignapi

我正在尝试通过REST API在信封级别添加自定义字段,但无法获取要保留的值。自定义字段已在UI中定义并在信封中显示,但没有分配的值。如果我添加一个未在UI中定义的自定义字段,那么它根本就不会出现。

如果我在最初创建信封后在第二次调用中添加新的自定义字段,它将起作用,但这似乎无关紧要。我做错了什么?

以下是在信封中创建新自定义字段的JSON:

{
    "emailSubject": "Please Print, Complete and Sign Document",
    "emailBlurb": "Please print and complete documents and sign on paper. ",
    "status": "sent",
    "customFields": {"textCustomFields":[{"name":"MyOwnField","required":"true","show":"true","value":"MyValue"}]},
    "compositeTemplates": [{
        "inlineTemplates": [{
            "sequence": "1",
            "recipients": {
                "signers": [{
                    "requireSignOnPaper": "true",          
                    "name":"Millard Fillmore",
                    "email":"dgilbert@firstallied.com",
                    "recipientId": "1",
                    "routingOrder": "1"
                }]
            }
        }],
        "document":
        {
            "documentId": "1",
            "name": "Corestone Account Application.pdf",
            "transformPdfFields": false
        }
    }]
}

1 个答案:

答案 0 :(得分:3)

customFields 对象需要位于 inlineTemplate 对象内。试试这个:

{
    "emailSubject": "Please Print, Complete and Sign Document",
    "emailBlurb": "Please print and complete documents and sign on paper. ",
    "status": "sent",
    "compositeTemplates": [{
        "inlineTemplates": [{
            "sequence": "1",        
            "customFields": {
                "textCustomFields": [{
                    "name": "MyOwnField",
                    "required": "true",
                    "show": "true",
                    "value": "MyValue"
                }]
            },
            "recipients": {
                "signers": [{
                    "requireSignOnPaper": "true",
                    "name": "Millard Fillmore",
                    "email": "dgilbert@firstallied.com",
                    "recipientId": "1",
                    "routingOrder": "1"
                }]
            }
        }],
        "document": {
            "documentId": "1",
            "name": "Corestone Account Application.pdf",
            "transformPdfFields": false
        }
    }]
}