對於以下要求我們希望使用DocuSign for SalesForce:
1.內部用戶,單擊頁面佈局上的一個按鈕,觸發DocuSign 2.社區用戶,單擊按鈕在VF頁面觸發DocuSign從模板創建信封時,Signature選項卡不可見
爲此,我連接了salesforce和Docusign帳戶。並完成基本配置,如在DocuSign和SalesForce之間掛接自定義變量,使用pdf和一些標籤創建模板,如簽名,初始和日期簽署。假設模板ID是aa3d9632-1595-4fef-87dd-1795334edf9d
。
現在,對於上面的第一個要求,我在頁面佈局上創建了一個使用創建的模板aa3d9632-1595-4fef-87dd-1795334edf9d
的JavaScript按鈕。在這裏,當內部用戶點擊按鈕,收件人可以看到所有選項卡(簽名,簽名初始和日期),它包括在模板中。
對於第二個要求,我使用SOAP API來觸發DocuSign。由於我已經有了一個模板aa3d9632-1595-4fef-87dd-1795334edf9d
,我想在我的第二個需求中也使用相同的模板。要做到這一點,我使用CreateEnvelopeFromTemplates()
方法請在下面的代碼:
//Step #1) Buiding Template, Recipient and Envelope information
// 1.1) Put the created template from DocuSign
DocuSignAPI.TemplateReference templetRef = new DocuSignAPI.TemplateReference();
templetRef.Template = aa3d9632-1595-4fef-87dd-1795334edf9d;
templetRef.TemplateLocation = 'Server';
DocuSignAPI.ArrayOfTemplateReference templetRefs = new DocuSignAPI.ArrayOfTemplateReference();
templetRefs.TemplateReference = new DocuSignAPI.TemplateReference[]{templetRef};
system.debug('templetRefs: '+templetRefs);
// 1.2) Create a Recipient
DocuSignAPI.Recipient recipient = new DocuSignAPI.Recipient();
recipient.Email = docuSign_email;
recipient.UserName = docuSign_fName+' '+docuSign_lName;
recipient.Type_x = 'Signer';
recipient.ID = 1;
recipient.RoutingOrder = 1;
recipient.RequireIDLookup = false;
DocuSignAPI.ArrayOfRecipient1 recipients = new DocuSignAPI.ArrayOfRecipient1();
recipients.Recipient = new DocuSignAPI.Recipient[]{recipient};
system.debug('recipients: '+recipients);
// 1.3) Construct the envelope information
DocuSignAPI.EnvelopeInformation envelopeInfo = new DocuSignAPI.EnvelopeInformation();
envelopeInfo.Subject = 'Terms of Agreement for your Signature';
envelopeInfo.EmailBlurb = 'We are sending you this request for your electronic signature, please review and electronically sign by following the link above. ';
envelopeInfo.AccountId = accountId;
//Populate Application as a Custom Field in Envelope
DocuSignAPI.CustomField custFiled = new DocuSignAPI.CustomField();
custFiled.Name = 'DSFSSourceObjectId';
custFiled.Value = docuSign_appID;
custFiled.show = 'False';
custFiled.Required = 'True';
custFiled.CustomFieldType = 'Text';
DocuSignAPI.ArrayOfCustomField CustFields = new DocuSignAPI.ArrayOfCustomField();
//CustFields.CustomField = new DocuSignAPI.CustomField[]{custFiled,accFiled};
CustFields.CustomField = new DocuSignAPI.CustomField[]{custFiled};
envelopeInfo.CustomFields = CustFields;
system.debug('envelopeInfo: '+envelopeInfo);
// Step #2) Create a Envelope with informtion created from step #1 and SendEnvelope
System.debug('Calling the API');
//DocuSignAPI.EnvelopeStatus es = dsApiSend.CreateAndSendEnvelope(envelope);
DocuSignAPI.EnvelopeStatus envelopStatus = dsApiSend.CreateEnvelopeFromTemplates(templetRefs, recipients,envelopeInfo,true);
envelopeId = envelopStatus.EnvelopeID;
在這種情況下,收件人無法看到它被列入任何標籤(初始和簽名日期簽名)在模板中。
奇怪的是,當用戶點擊頁面佈局JavaScript按鈕點擊時,這些標籤是可見的,但不是在VF頁面按鈕點擊。
請分享您的信封創建代碼。沒有看到代碼很難說。 –