0 Replies Latest reply on Nov 14, 2016 8:57 AM by attiqu74255647

    Sending e-sign document via Apex Trigger or Process Builder

    attiqu74255647 Level 1

      Hi,

       

      I want to send e-sign agreement either with an Apex trigger or via Process Builder. I have configured "Send on behalf of" field to a salesforce user. I have created a record in echosign_dev1__SIGN_Agreement__c object, have populated recipient and linked to master opportunity as well as follow

       

      for(Opportunity opp: opps)

          {

              if(opp.Offer_Stage_Status__c=='Offer Accepted' && opp.Applicant_1__r.PersonEmail!=null)

              {

                  echosign_dev1__SIGN_Agreement__c ag=new echosign_dev1__SIGN_Agreement__c();

                  ag.Name=opp.Name + System.now();

                  ag.echosign_dev1__Sender_User__c=setting.EchoSign_Sender_User__c;

                  ag.echosign_dev1__Opportunity__c=opp.Id;

                  ag.echosign_dev1__Recipient__c=opp.Applicant_1__r.PersonContactId;

                  agreements.add(ag);

                  mapOppAgreement.put(opp.Id, ag);

              }

          }

          if(agreements.size()>0)

              INSERT agreements;

       

      The above code inserts the agreements. There is more code after the above segment which attaches a PDF file to the record inserted above.

       

      Now I want to trigger the send action. Any idea how should I trigger the document sending?

       

      Ideally I'd like API function to send the document.

       

      Regards,

      Attiq