首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不与APEX代码合并

不与APEX代码合并
EN

Stack Overflow用户
提问于 2020-11-03 20:13:47
回答 3查看 655关注 0票数 0

我将机会id发送到mySourceId到例程中,并运行应该是标准的Docusign例程。我们有一个按钮来完成这个合并使用标准的DocuS传例程,但正在试图绕过所有额外的按钮点击,用户必须忍受。

我有一个模板,该模板可以在文档上创建,并可在文档上使用与Salesforce相关的自定义字段标记。文件里有我遗漏的东西吗?

代码语言:javascript
复制
        //create the emptyenvelope connecting it to the SF object
        myEnvelope = dfsle.EnvelopeService.getEmptyEnvelope(new dfsle.Entity(**mySourceId**));

        //use the Recipient.fromSource method to create the Recipient
        dfsle.Recipient myRecipient = dfsle.Recipient.fromSource(sender.name, // Recipient name
                                                                 sender.eAddress, // Recipient email
                                                                 null, //Optional phone number
                                                                 sender.role, //Role Name. Specify the exact role name from template
                                                                 new dfsle.Entity(**mySourceId**)); //source object for the Recipient
        //add email detail for the envelope
        myEnvelope = myEnvelope.withEmail(settingsDocusignTemplate.get(sourceName).email_subject__c, settingsDocusignTemplate.get(sourceName).email_body__c);

        //Could provide automatic notifications as well based off of criteria
        final boolean dfsle_reminder = settingsDocusignTemplate.get(sourceName).reminder__c;
        final integer dfsle_remindAfterDays = Integer.valueOf(settingsDocusignTemplate.get(sourceName).remindAfterDays__c); //wait before sending reminder
        
        //add Recipient to the Envelope
        myEnvelope = myEnvelope.withRecipients(new List<dfsle.Recipient> { myRecipient });

        //create a new document for the Envelope
        dfsle.Document myDocument =     dfsle.Document.fromTemplate((dfsle.UUID)templateInfo.get('UUID'), // templateId in dfsle.UUID format
        (String)templateInfo.get('name')); // name of the template

        //add document to the Envelope
        myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });

    try {
            
        System.debug('\tSending Envelope');
        dfsle.EnvelopeService.sendEnvelope(myEnvelope, // The envelope to send
                                                    true); // Send now?
    } catch (dfsle.DocuSignException docusignExcpt) {
        ErrorLogUtil.createErrorLogData(docusignExcpt,CLASS_NAME,METHOD_NAME,null,null);
    } catch (Exception excp) {
        ErrorLogUtil.createErrorLogData(excp,CLASS_NAME,METHOD_NAME,null,null);
    }
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-11-09 17:55:38

尝试在“为信封创建一个新文档”之后将其添加到您的代码中。

代码语言:javascript
复制
String opptyStr = (String) myOpportunity.Id + '~Opportunity';
        dfsle.CustomField myField = new dfsle.CustomField ('text', 'DSFSSourceObjectId', opptyStr, null, false, false);

//add document to the Envelope
myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument })
.withCustomFields(new List<dfsle.CustomField> {myField});

从技术上讲,合并字段是不支持的,但是我们可以通过使用此代码的自定义字段来解决这个问题。

票数 0
EN

Stack Overflow用户

发布于 2020-11-10 06:38:12

withCustomFields(新List {myField})

如何将多个字段添加到新的List {myField}列表中?

票数 0
EN

Stack Overflow用户

发布于 2020-11-10 19:56:16

最后看起来是这样的;

代码语言:javascript
复制
        templateInfo.put('Source_Reference',(String) mySourceId + '~Opportunity');

        dfsle.CustomField sourceField = new dfsle.CustomField ('text', 'DSFSSourceObjectId', (String)templateInfo.get('Source_Reference'), null, false, false);

        //add document to the Envelope
        myEnvelope = myEnvelope.withDocuments(new List<dfsle.Document> { myDocument });

        //populate the custom fields on the Envelope
        myEnvelope = myEnvelope.withCustomFields(new List<dfsle.CustomField> {sourceField});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64669971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档