function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
XhitmanXhitman 

Echosign Agreement Automation issue

 

We are currently a user of Echosign for Salesforce and we are in the process of automating the creation of echosign details with a click of a button.
What we would like is to create the Echosign's agreement record, fill up all the necessary fields, create the agreement record and then attach the document and possibly send the document to the recepient all in one go via Force.com Sites.
Everything is currently working quite well like the agreement record gets created and the attachment automatically attached but the problem is that when I try to click the "Send to Echosign", it doesn't send anything to me although the status says that it was already sent.
I tried creating one manually using the exact information inside Salesforce via the Agreemnt tab and it was able to send me the email notification that I have an agreement to sign.
Any ideas if there are any difference between creating a record manually vs. creating it via code? It seems like the Agreement tab only uses the standard Salesforce pages.
You could refer to my code below.
echosign_dev1__SIGN_Agreement__c agmt = new echosign_dev1__SIGN_Agreement__c();
agmt.Name = 'Sample Agreement';
agmt.Social_Ads_Campaign__c = currentSACId; // Custom lookup field 
agmt.echosign_dev1__Recipient__c = getselectedSAC().Delivery_Partner_Contact__c;// Contact field
agmt.echosign_dev1__RemindRecipient__c = 'Every Day, Until Signed'; 
agmt.echosign_dev1__SenderSigns__c = true;
agmt.echosign_dev1__Message__c = 'Please sign the attached Insertion Order';
agmt.echosign_dev1__SignatureType__c = 'e-Signature';
agmt.echosign_dev1__PasswordProtectSign__c = false; 
agmt.echosign_dev1__SenderSigns__c = true;           
agmt.echosign_dev1__PasswordProtectPDF__c = false;  
agmt.echosign_dev1__SignatureOrder__c = 'I sign, then the Recipient signs';
agmt.echosign_dev1__Status__c = 'Draft';
insert agmt;

 

We are currently a user of Echosign for Salesforce and we are in the process of automating the creation of echosign details with a click of a button.


What we would like is to create the Echosign's agreement record, fill up all the necessary fields, create the agreement record and then attach the document and possibly send the document to the recepient all in one go via Force.com Sites.
Everything is currently working quite well like the agreement record gets created and the attachment automatically attached but the problem is that when I try to click the "Send to Echosign", it doesn't send anything to me although the status says that it was already sent.

 

I tried creating one manually using the exact information inside Salesforce via the Agreemnt tab and it was able to send me the email notification that I have an agreement to sign.

 

Any ideas if there are any difference between creating a record manually vs. creating it via code? It seems like the Agreement tab only uses the standard Salesforce pages.


You could refer to my code below:

 

echosign_dev1__SIGN_Agreement__c agmt = new echosign_dev1__SIGN_Agreement__c();
agmt.Name = 'Sample Agreement';
agmt.Social_Ads_Campaign__c = currentSACId; // Custom lookup field 
agmt.echosign_dev1__Recipient__c 			= getselectedSAC().Delivery_Partner_Contact__c;// Contact field
agmt.echosign_dev1__RemindRecipient__c 		= 'Every Day, Until Signed'; 
agmt.echosign_dev1__SenderSigns__c			= true;
agmt.echosign_dev1__Message__c 				= 'Please sign the attached Insertion Order';
agmt.echosign_dev1__SignatureType__c 		= 'e-Signature';
agmt.echosign_dev1__PasswordProtectSign__c 	= false; 
agmt.echosign_dev1__SenderSigns__c 			= true;           
agmt.echosign_dev1__PasswordProtectPDF__c 	= false;  
agmt.echosign_dev1__SignatureOrder__c 		= 'I sign, then the Recipient signs';
agmt.echosign_dev1__Status__c 				= 'Draft';
insert agmt;

PageReference pdfPage = Page.SocialAdCampaignIOPDF;
pdfPage.getParameters().put('id', currentSACId);
Blob pdfBlob = Blob.valueOf('Sample PDF');
pdfBlob = pdfPage.getContentAsPDF();
String filename = agmt.Name + ' ' + DateTime.Now().format('MM-dd-yy') + '.pdf';
Attachment a = new Attachment(parentId = agmt.id, name=filename, body = pdfBlob, ContentType = 'application/pdf');
insert a;

 

 

Best Answer chosen by Admin (Salesforce Developers) 
XhitmanXhitman
It looks like the issue is on the "I sign, then the Recipient signs". The reason why I am not getting the notification is that I am not the sender. I just have to set it to "Recipient signs, then I sign" so that I would get the notification first. This is all good now. :)

All Answers

XhitmanXhitman
It looks like the issue is on the "I sign, then the Recipient signs". The reason why I am not getting the notification is that I am not the sender. I just have to set it to "Recipient signs, then I sign" so that I would get the notification first. This is all good now. :)
This was selected as the best answer
pd624pd624
Hi,
We're trying to do something similar.

Right now all this doc. signing is done manually by us using the Echosign plugin after logging into our sales force account.

On our company website we would like to show a list of pre-configured docs. on sales force and when a user clicks "sign It" we would like to send him an email notification( the same email sent via Echosign Plugin for sales force) with a link to the doc. on Echosign.
So, i have 2 questions ...
(i) How to create a functionality to "Press" the "Send for Signature" button on echosign plugin, in our code ?
We would like to let echosign take care of the signing and saving back to SalesFoce part.

(ii) We just want, on our company website, to automate the first part where one specifies a doc. and a customer( signer) and presses the "Send for Signature" button.

Do you see any problems in this approach ?

Thanks
Chandra
vgandla@60demo.comvgandla@60demo.com

Hi All,

 

I am sending the aggrement through sites (Creating the aggrement record programmatically). I got the mail for esign, i signed the document, after signing the document i got the signed attachment through mail. If i openned the aggrement record in salesforce, status is still showing the "Out For Signed" eventhough document is signed. Atomatic updates also i did. Please help me what i need to do for updating the status in salesforce aggrement record.

Kiran Kumar GottulaKiran Kumar Gottula
public class callechosignapi {

     public void callapi(){
   
       /******/
       String webServiceUrl = 'https://secure.echosign.com/services/EchoSignDocumentService17';
       Blob pdfBlob = Blob.valueof('Test Body');       
       dtoApiEchosign.DocumentCreationInfo Docinfo = new dtoApiEchosign.DocumentCreationInfo();
       dto12ApiEchosign.SendDocumentInteractiveOptions sendinteractiveoptn = new dto12ApiEchosign.SendDocumentInteractiveOptions();  
       /******/
      
       /******/
       try
       {
        list<dto14ApiEchosign.RecipientInfo> lstRecip = new list<dto14ApiEchosign.RecipientInfo>();
        dto14ApiEchosign.ArrayOfRecipientInfo ObjArrayRecip = new dto14ApiEchosign.ArrayOfRecipientInfo();
        dto14ApiEchosign.RecipientInfo RecipientInfo = new dto14ApiEchosign.RecipientInfo(); 
        RecipientInfo.email = 'XXXXXXXXXXXXXXXXXXXXXXXXXX';
        RecipientInfo.role = 'SIGNER';    
        lstRecip.add(RecipientInfo);
        ObjArrayRecip.RecipientInfo = lstRecip;
        Docinfo.recipients=ObjArrayRecip;
       }
       catch(Exception ex)
       {
            System.debug('Docinfo.recipients Ex---->'+ex);
       }
      
       /******/
      
       /******/
       list<dtoApiEchosign.FileInfo> lstFileInfo = new list<dtoApiEchosign.FileInfo>();
       dtoApiEchosign.ArrayOfFileInfo ObjArrayInfo = new dtoApiEchosign.ArrayOfFileInfo();
       dtoApiEchosign.FileInfo FileInfo = new dtoApiEchosign.FileInfo();  
       Docinfo.name = 'TestName';
       FileInfo.fileName = 'TestFileName';
       FileInfo.file= EncodingUtil.base64Encode(pdfBlob);     
       FileInfo.mimeType = 'application/pdf';
       lstFileInfo.add(FileInfo);
       Docinfo.signatureType = 'ESIGN';
       Docinfo.signatureFlow = 'SENDER_SIGNATURE_NOT_REQUIRED';
       ObjArrayInfo.FileInfo = lstFileInfo;
       Docinfo.fileInfos = ObjArrayInfo;
       /******/
      
       /******/
       sendinteractiveoptn.authoringRequested = true;
       sendinteractiveoptn.autoLoginUser = true;
       sendinteractiveoptn.noChrome = false;
       /******/
      
       dtoApiEchosign.SenderInfo senderInfo = new dtoApiEchosign.SenderInfo();       
       senderInfo.email = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
       senderInfo.password = 'XXXXXX';
       String apiKey = 'XXXXXXXXXXXX';
   
       apiEchosign.EchoSignDocumentService17HttpPort APIEcoSignObj = new apiEchosign.EchoSignDocumentService17HttpPort();
         system.debug('***Response***'+APIEcoSignObj.sendDocumentInteractive(apiKey, null, Docinfo, sendinteractiveoptn));
   }
}