0 Replies Latest reply on Apr 10, 2015 6:36 AM by edwardsilverlinecrm

    How can I send out pending agreements for signature en masse on a scheduled basis?


      I'm using EchoSign's Salesforce integration, and I'm trying to create a scheduled batch that will send out a large number of agreements for signature.  EchoSign has some exposed global methods that I'd hoped will help facilitate this, namely AgreementTemplateService.load, which generates an agreement based on an agreement template ID, and EchoSignAPIService.sendDocument, which sends out an agreement that it is provided.  Also, using the background action field on Agreement, it is possible to update an Agreement to 'Send', triggering its send-out.


      I can do all this through code anonymously, or via a custom page at the click of a button, but to do it without user interaction is proving difficult.  Regardless of whether I try to do it via trigger or scheduled batch, the above-mentioned methods fail out in different ways that essentially amount to the same problem (trying to call a future method from a batch, or a callout from a trigger); I've reproduced the error messages here (these are stamped onto the agreement record and displayed when the record is viewed):

      System.CalloutException: Callout from triggers are currently not supported

      System.AsyncException: Future method cannot be called from a future

      You have uncommitted work pending. Please commit or rollback before calling out


      It seems the above methods are intended for use in a custom page, rather than in some scheduled, non-interactive use-case.  Is there any workaround for this, or support for sending out agreements at a scheduled time, rather than at the click of a button?  Thanks!