我正在尝试通过 apex 发送我的 docusign 签名机会记录,我想添加一些我需要信封模板 ID 的自定义 apex 逻辑,但它没有填充在对象“Docusign Envelope”下,值为空,但是当我通过填充该字段的 docusign 创建按钮发送签名。不确定我在这里做错了什么。以下是顶点代码:
mySourceId = '006S000000OARxxxxx'; // 发起 Salesforce 对象的 ID String templateId ='xxxxxxxx-xxxx-xxxx-xxxx-ba3e7fe374a2'; // DocuSign 模板的 ID
// Create an empty envelope
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(
new dfsle.Entity(mySourceId));
// The initiating Salesforce entity
// Use myEnvelope for later
// We will use a Salesforce contact record as a Recipient here
opportunity oppo = [select id,ownerid,owner.Name,owner.email,email_Custom__c,Name__Custom__cfrom opportunity where id =: mySourceId ];
//use the Recipient.fromSource method to create the Recipient
dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(
oppo.Name__Custom__c, // Recipient name
oppo.email_Custom__c, // Recipient email
null, // Optional phone number
'Signer 1', // Role Name. Specify the exact role name from template
new dfsle.Entity(oppo.Id)); // Source object for the recipient
dfsle.Recipient myRecipient1 = dfsle.Recipient.fromSource(
oppo.owner.name, // Recipient name
oppo.owner.email, // Recipient email
null, // Optional phone number
'Signer 2', // Role Name. Specify the exact role name from template
new dfsle.Entity(oppo.Id));
// Add a recipient to the envelope
myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient,myRecipient1 });
// myTemplateId contains the DocuSign Id of the DocuSign Template
dfsle.UUID myTemplateId = dfsle.UUID.parse(templateId);
// create a new document for the Envelope
dfsle.Document myDocument = dfsle.Document.fromTemplate(
myTemplateId, // Template Id in dfsle.UUID format
'EVSE Site Agreement Template1'); // Name of the template
//add document to the envelope
myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });
// Send the envelope
myEnvelope = dfsle.EnvelopeService.sendEnvelope(
myEnvelope, // The envelope to send
true); // True to send the envelope now
我尝试创建新模板,但该字段仍未填充。