0

用例 - Salesforce Docusign 实施:

我们在 Salesforce 中有父对象和子对象,其中父对象具有授权签名者和关系管理器的电子邮件信息,并且它们的每个子对象都有我们需要由授权签名者和关系管理器签名的文档。

我们需要在单个信封中发送所有子对象文档。并且当签字仪式完成后,我们需要将各自签署的文件附加到各自的孩子记录中。

目前,我们可以通过 Apex Toolkit 或 DocuSign REST API 进行规划。

示例:授权签名者和 RM 出现在帐户记录中。并且与帐户相关联的每个联系人都具有由联系人附加的文档。帐户所有者应该有一个按钮,它应该从相关联系人那里获取所有文件,创建信封,应该在每个文件上标记签名并能够发送给授权的签名者和 RM。

授权签名者应收到所有文件,并装在一个信封中。他们签署了所有文件。一旦由他们签署,所有签署的文件都应返回给各自的联系人。

注意:企业还希望查看所有收件人状态和发送给 Salesforce 最终用户的文档。

您能否就此提供意见并根据我们的用例分享一些示例?

4

1 回答 1

0

这里的流程是使用 DocumentService.getLinkedDocuments 提取文档,然后设置锚选项卡。如果要发送多个文档,则需要将 Anchor Population Scope 设置为 Document。如果文档按列表 1、2、3 的顺序编号。您将使用 .withOptions 进行回写。示例可以在这里找到: https ://www.docusign.com/blog/developers/whats-new-summer-21-apex-toolkit 和一个示例代码(写回部分除外):

//Find your contact to add
Contact myContact = [SELECT Id, Name, Email FROM Contact WHERE Name = 'Snow Beard' LIMIT 1];
//This sets tab as an anchor tab. If using this with multiple documents, 
// Ask customer support to set Account Setting Anchor Population Scope to Document.
dfsle.Tab hereTab = new dfsle.SignHereTab()
        .withScale(1) // 1/2 scale
        .withRequired(true) // Signing mandatory
        .withDataLabel('SignHereMeHardy')
        .withAnchor(
                new dfsle.Tab.Anchor(
                        'Anchor1', // Anchor string
                        true, // allow white space in anchor string
                        true, // Anchor string is not case sensitive
                        'right', // Horizontal alignment in relation to the anchor text
                        true, // Ignore if the anchor text is not present in the document
                        true, // Must match the value of the anchor string in its entirety
                        'pixels', // Unit of the x and y offset properties
                        10, // X offset
                        10 // Y offset
                )
        )
        //This places the tab on the first docunent in the list on page one. Requires DocuSign Support to set Anchor Population Scope to Document.
        .withPosition(
                new dfsle.Tab.Position(
                        1, //Document id matches order of documents
                        1, //Page id
                        null,
                        null,
                        20,
                        20
                )
        );
        
//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 if using a template or use Default 'Signer 1'
        new dfsle.Entity(myContact.Id)    //source object for the Recipient
        )
        .withTabs(new List<dfsle.Tab> { // Associate the tabs with this recipient
        hereTab
        });
        
Opportunity myOpportunity = [SELECT Id FROM Opportunity WHERE Name = 'Sailcloth' LIMIT 1];
        
//This pulls all the documents from the Opportunity Object and adds them to documents list
List<dfsle.Document> documents = dfsle.DocumentService.getLinkedDocuments
        (
        ContentVersion.getSObjectType(),
        new Set<Id>{myOpportunity.Id},
        false
        );
        
// Create an empty envelope.
// This shows how to pull documents from an object in Salesforce. In this case an Opportunity
dfsle.Envelope myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(new dfsle.Entity(myOpportunity.Id))
        .withRecipients(new List<dfsle.Recipient> { myRecipient })
        .withDocuments(documents);
        
// Send the envelope
try {
    dfsle.EnvelopeService.sendEnvelope(myEnvelope, true);
    } catch (dfsle.APIException ex) {
        system.debug(ex);
            if (ex.error.code == dfsle.APIErrorCode.CONSENT_REQUIRED) {
    // user is a valid member of the DocuSign account, but has not granted consent to this application
    } else {
    // handle other errors
    }
}
于 2022-01-18T08:51:14.500 回答