简体   繁体   中英

Salesforce: Auto-populate DocuSign recipient with the opportunity owner's manager

I am working on a button logic on my opportunity layout for docusign for salesforce. It is pretty basic, and I just need

  • My template to be selected

  • My commercial contact to be set as the first recipient on my template

  • the manager of my opportunity owner to be set as the second recipient on my template

  • The opportunity owner to be set as the third recipient

My template has 3 pre-defined roles called "client signer"=signer 1, "company siner"= signer 2; and a carbon copy recipient (my opportunity owner). To make things easier; I created formula fields on the opportunity layout that pull the email and name info. They all show up fine on the URL I generate; but only the client signer is shown as a recipient on the interface

I have tried countless time to apply what was on the guide; but only my first contact role seems to populate. Here is what I have now. I tried to play around with the CRL, CCTM etc.. but it did not work yet

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")} 

//********* Option Declarations (Do not modify )*********// 
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';
var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';
var DST='';var LA='';var CEM='';var CES='';var STB='';
var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES=''; 
//*************************************************// 

//Adding Notes & Attachments 
var LA='0'; 

//Custom Recipient Contact List 
var CRL='Email~{!Opportunity.Client_Signer_Email_crm__c};
FullName~{!Opportunity.Client_Signer_Full_Name__c}; 
RoutingOrder~1; 
Email~{!Opportunity.Customer_Signer_Email_crm__c}; 
FullName~{!Opportunity.Customer_Signer_Full_Name_crm__c}; ;
RoutingOrder~2' ; 

//Custom Envelop from Docusign 
var DST='B85135B8-6F97-49C6-AAE3-96333518AC5D'; 

//********* Page Callout (Do not modify) *********// 
window.location.href =
  "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC
  +"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM
  +"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO
  +"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES
  +"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES
  +"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

The docs say

You can specify multiple comma-separated recipients but the length of the entire CRL string must be 1000 characters or less.

In other words (I agree the docs could be improved), each recipient in the CRL string has multiple, optional fields. For a specific recipient, separate the fields with semicolons.

Separate the multiple recipients with commas. (This is what you missed.)

Also, your JavaScript could be a little clearer. You can define multiple variables with a single var statement. You also don't need to repeat the var statement for a given variable.

Try:

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")} 

//********* Option Declarations (Do not modify )*********// 
var RC = '', RSL='',  RSRO='', RROS='', CCRM='',
    CCTM='', CCNM='', CRCL='', CRL='',  OCO='',
    DST='',  LA='',   CEM='',  CES='',  STB='',
    SSB='',  SES='',  SEM='',  SRS='',  SCS ='', RES=''; 
//*************************************************// 

// Docs: https://support.docusign.com/guides/dfs-admin-guide-customize-envelope-contacts

// Adding Notes & Attachments 
LA='0'; 

// Custom Recipient Contact List 
var 
  recip1 = "Email~{!Opportunity.Client_Signer_Email_crm__c};" +
           "FullName~{!Opportunity.Client_Signer_Full_Name__c};" + 
           "RoutingOrder~1;",
  recip2 = "Email~{!Opportunity.Customer_Signer_Email_crm__c};" +
           "FullName~{!Opportunity.Customer_Signer_Full_Name_crm__c};" +
           "RoutingOrder~2"; 

CRL = recip1 + "," + recip2;

//Custom Envelop from Docusign 
DST='B85135B8-6F97-49C6-AAE3-96333518AC5D'; 

//********* Page Callout (Do not modify) *********// 
window.location.href =
  "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&"
  +"SourceID={!Opportunity.Id}&RC="+RC
  +"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM
  +"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO
  +"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES
  +"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES
  +"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM