[英]Can you store an email subject/body for a specific envelope type in DocuSign?
Each envelope type will have its own email subject/body that is static for that envelope type. 每种信封类型都有自己的电子邮件主题/正文,该主题对于该信封类型是静态的。 Here is an example of a few predetermined envelope types: 这是一些预定的信封类型的示例:
These envelopes will contain a varied number of documents and each document is unique. 这些信封将包含不同数量的文档,并且每个文档都是唯一的。 I've attempted to create a template without a document, but it appears that is not allowed. 我试图创建一个没有文档的模板,但是似乎不允许这样做。
I'd like to be able to save the email body and subject for these envelope types so that when I send an envelope via the DocuSign API, I don't have to directly specify these fields. 我希望能够为这些信封类型保存电子邮件正文和主题,这样,当我通过DocuSign API发送信封时,不必直接指定这些字段。 I'm hoping to avoid storing the subject/body inside of code or a configuration file. 我希望避免将主题/正文存储在代码或配置文件中。 Preferably, I'd like a non-technical person to be able to change the subject/body through the DocuSign interface. 最好,我希望非技术人员能够通过DocuSign界面更改主题/身体。
What I ended up doing: 我最终要做的是:
Based on Kim Brandl's recommendations, I wrote the following code which worked as expected. 根据Kim Brandl的建议,我编写了以下符合预期的代码。 A few notes: 一些注意事项:
The Recipients, signers, documents, etc., follow the same pattern as a standard EnvelopeDefinition except the data is placed under the InlineTemplate. 收件人,签名者,文档等遵循与标准EnvelopeDefinition相同的模式,只是数据位于InlineTemplate下。
string docBase64 = Convert.ToBase64String(file.Stream.ReadAsBytes()); EnvelopeDefinition envDef = New EnvelopeDefinition(); envDef.Status = "created"; // The first sequence that appears will be the first document that is applied. // If you want the uploaded documents to appear instead of the server template, // make the server template a higher number. envDef.CompositeTemplates = new List<CompositeTemplate> { new CompositeTemplate() { ServerTemplates = new List<ServerTemplate>() { new ServerTemplate("2", templateId) }, InlineTemplates = new List<InlineTemplate>() { new InlineTemplate() { Sequence = "1", Recipients = new Recipients() { Signers = new List<Signer>() { new Signer() { Email = request.Recipients[0].UserEmail, Name = request.Recipients[0].UserName, RoleName = request.Recipients[0].RoleName, RecipientId = (1).ToString() } } }, Documents = new List<Document>() { new Document() { DocumentBase64 = docBase64, DocumentId = "3", Name = "ConsentFake.pdf", IncludeInDownload = "true" }, new Document { DocumentBase64 = docBase64, DocumentId = "9", Name = "ConsentFake2.pdf", IncludeInDownload = "true" } } } } } };
Summary: This allowed me to take advantage of a DocuSign template's email subject/body without having to use a specific template document. 简介:这使我可以利用DocuSign模板的电子邮件主题/正文,而不必使用特定的模板文档。
You can implement a solution for the scenario that you've described by doing the following: 您可以通过执行以下操作为所描述的方案实施解决方案:
Using the DocuSign web UI, create a Template for each 'type of Envelope' and specify the Email Subject and Body in each Template that you create. 使用DocuSign Web UI,为每个“信封类型” 创建一个模板 ,并在创建的每个模板中指定电子邮件主题和正文。 You'll also need to upload a document to the Template (DocuSign requires that you add at least one document before you can save the Template) -- but you can just add any placeholder doc (for example, a .txt file that contains the word placeholder file ). 您还需要将文档上载到模板(DocuSign要求至少添加一个文档才能保存模板)-但是您可以添加任何占位符文档(例如,包含字占位符文件 )。 The document you add to the template won't actually be used in the Envelopes that you create from the Template -- since you'll use the API to specify documents at runtime. 您添加到模板中的文档实际上不会在通过模板创建的信封中使用-因为您将在运行时使用API指定文档。 (Non-technical folks will be able to use the DocuSign web UI to modify/update the email info in each Template at any point in the future.) (非技术人员将来可以在任何时候使用DocuSign Web UI修改/更新每个模板中的电子邮件信息。)
When sending an Envelope via the API, use the compositeTemplates
structure in the "Create Envelope" API request. 通过API发送信封时,请在“创建信封” API请求中使用compositeTemplates
结构。 By using the compositeTemplates
structure, you can specify the serverTemplate
to use (which will pull in the Email Subject and Email Body that you've defined in that Template), specify recipient and tab info by using the inlineTemplate
object, and specify document info using the document
object. 通过使用compositeTemplates
结构,您可以指定要使用的serverTemplate
(它将拉入您在该模板中定义的“电子邮件主题”和“电子邮件正文”),使用inlineTemplate
对象指定收件人和标签信息,并使用以下inlineTemplate
指定文档信息document
对象。
(There's lots of info available here on Stack Overflow about how to use compositeTemplates
in the Create Envelope request. If you have trouble getting that request structure correct/working, please post a separate question.) (有关堆栈溢出的信息,这里有很多关于如何在Create Envelope请求中使用compositeTemplates
的信息。如果您在使请求结构正确/正常工作时遇到困难,请提出一个单独的问题。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.