Skip to main content
We currently use complex Conga merge documents, and then attach them to an Echosign agreeemt.  Well, now I'd like to find a way to drop the Conga documents from the process.  Document is getting even more complex, and I'm going to use visualforce and apex to create the document that is to be signed. So, ...

Can visualforce rendered as a PDF, have embedded signature tags?  

Thanks

 
15 réponses
  1. 18 févr. 2016, 20:54
    Here is the code that was finally put in place.  Nahuel was close - but I had to actually insert the echosign_dev1__SIGN_Agreement__c record first. 

     

    // Build page reference for contract PDF & attach to the contract record

    pageReference pdfPage = Page.ContractPDF;

    pdfPage.getParameters().put('ContractId',pContractId);

    blob pdfBody;

    if(Test.isRunningTest()) {

    pdfBody = blob.valueOf('Unit.Test');

    } else {

    pdfBody = pdfPage.getContentAsPDF();

    }

    // Build Echosign agreement record

    echosign_dev1__SIGN_Agreement__c agreementRec = new echosign_dev1__SIGN_Agreement__c();

    agreementRec.Name = 'Agreement - ' + contract.Account.Name + ' - ' + contract.startDate.format() ;

    agreementRec.echosign_dev1__Signaturetype__c = 'e-Signature';

    agreementRec.echosign_dev1__Recipient__c = contract.CustomerSignedId;

    agreementRec.echosign_dev1__Recipient_User__c = administratorId;

    agreementRec.echosign_dev1__Recipient_Signing_Order__c = 'Sequential';

    agreementRec.echosign_dev1__Contract__c = pContractId;

    agreementRec.echosign_dev1__Account__c = contract.AccountId;

    agreementRec.echosign_dev1__Enable_Hosted_Signing__c = true;

    insert agreementRec;

    // insert the pdf as an attachment and set to the agreement

    attachment pdfFile = new attachment();

    pdfFile.isPrivate = false;

    pdfFile.body = pdfBody;

    pdfFile.parentId = agreementRec.id;

    pdfFile.Name = 'Agreement ' + contract.Account.Name + ' - ' + contract.startDate.format() + '.pdf';

    insert pdfFile;

     
0/9000