当某些 CPQ 报价符合某些标准时,我每天都会在 Salesforce 中发送文件。这将是一个预定的过程,我为需要发送的文档创建了一个 DocuSign 信封模板。我正在利用 Apex 工具包,因为这是一个自动化过程。
在文档中,我还需要在表格中显示相关的子报价行记录。使用该工具包,我可以使用放置在文档中的锚文本添加简单的选项卡。我尝试在 Salesforce 中的模板构建器 UI 中配置锚文本,但没有成功地提取我需要的数据。
工具包是否能够为相关记录构建表格,或者它是否更多地用于非常简单的选项卡来显示数据而不是构建如此动态的东西?
您可以使用 SOQL 查询获取 Salesforce 中的记录,并将该数据放入选项卡中。例如,在设置收件人的情况下,您可以使用 SOQL 查询在 Salesforce 中检索联系人记录,并通过将该数据放入收件人对象来发送信封。
//we will use a Salesforce contact record as a Recipient here
Contact myContact = [SELECT Id, Name, Email FROM Contact LIMIT 1];
//use the Recipient.fromSource method to create the Recipient
dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(
myContact.Name, // Recipient name
myContact.Email, // Recipient email
null, //Optional phone number
'Signer 1', //Role Name. Specify the exact role name from template
new dfsle.Entity(myContact.Id)); //source object for the Recipient
//add Recipient to the Envelope
myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient });