You need to sign in to do that
Don't have an account?
Geoffrey Lamb
EchoSign Trigger: Send Contract onCreate of record
I recently installed EchoSign for Salesforce and finally have things up and running with my users being able to send documents with a single click. Now, I need to take it one step further and figure out a way to send a contract without user interaction, at the time a record (Lead) is created.
Adobe talks about workflows in thier marketing but offers no obvious direction as to how to go about setting them up. As far as I can tell, this is not something which is a part of standard workflows so it sounds like I'm going to have to write another trigger??
Well, I've written a few triggers in the past but I am far from an expert. I can do it, I just need something to show me the way... I would appreciate any links or code snippets that anyone could offer. I'm sort of lost at this point and Adobe help & support is basically non-existent.
Thank you!
PS: I know how to find the basic Salesforce help guides on Apex Triggers - I need something specific to EchoSign. Thanks!
Adobe talks about workflows in thier marketing but offers no obvious direction as to how to go about setting them up. As far as I can tell, this is not something which is a part of standard workflows so it sounds like I'm going to have to write another trigger??
Well, I've written a few triggers in the past but I am far from an expert. I can do it, I just need something to show me the way... I would appreciate any links or code snippets that anyone could offer. I'm sort of lost at this point and Adobe help & support is basically non-existent.
Thank you!
PS: I know how to find the basic Salesforce help guides on Apex Triggers - I need something specific to EchoSign. Thanks!
I just came across your old question. Did you ever find a solution to this without using Triggers?
Funnily enough when I spoke to Adobe earlier in the year I brought up the exact same point you did about it being mentioned in their marketing (which was my main reason for purchasing) yet it doesn't actually allow this.
I've also been trying to get a solution without a trigger (as I can't write code), and I was told by Salesforce to trial the new Lighning beta - but also struggling to make it work there?
Cheers,
Ali
Unfortunately, I do not know how to initiate an Echosign agreement without using code. The line which initiates the package is below, it could be dropped into a basic insert or update trigger pretty easily.
echosign_dev1.AgreementTemplateService.load( [AgreementTemplateId] , [RecordId] )
PS: Don't let the code intimidate you! I didn't know anything this time last year and now, I can do almost anything I need. It wasn't easy but definitely not impossible - I just read the forums and troubleshot everything until it worked. Knowing some basic triggers is super helpful for stuff like this.
Thanks!
I can't be sure without seeing all of the trigger's code and/or the debugging script - but it sounds like the method above is actually working for you, otherwise, it seems like the agreement itself would have some sort of error (not related to sending) or not be created at all??
The piece of the puzzle that makes the agreement send, if I remember correctly, is in the template and not the apex code. I think the code just creates the template, like the send button... so it's odd that the send button works perfectly while the code does not.
Some random ideas:
- Did you add a mapping to the template, so that the word "send" would be inserted into the On_Load_Action__c field at agreement creation?
- Did you add the recipients in the agreement template?
- Do they have a valid email address? (seems easy, but screws with us all the time)
- Is your send agreement button taking any actions or doing anything that is not connected with creation of the template?
- If it's doing anything else programmatically then perhaps that needs to be replicated in your trigger, prior to invoking the AgreementTemplateService.load() method??
That’s what i could come up with for now. If none of this is the issue, I may be able to help more tomorrow with the trigger code or the debugging logs. Knowing what exactly is null would be really helpful and that should hopefully be clear upon review of the logs and code. Also, having a copy of the send agreement javascript may be useful too. I'd like to know what precisely is different, between your broken trigger and the script in your working button.Good luck!
1) We do have a Merge Mapping defined in the Template, but not a Data Mapping, but thought that was only for bringing data fields back into SF.
2) Yes we have Recipient defined to pull from email field on the Account
3) There shoudl be nothing special about the button, we are using the standard Send For Signature echosign button. URL is - /apex/echosign_dev1__AgreementTemplateProcess?masterId={!Account.Id}
The trigger code is very basic, but attached here (just the important part). Yes I've written a lot of triggers before.
trigger EchoSignSendAgreement on Account (after insert) {
List<Account> accts = Trigger.new;
echosign_dev1__Agreement_Template__c tem= [Select Id from echosign_dev1__Agreement_Template__c Where Name='Merchant Agreement Consumer Goods'];
for (Account acct : accts) {
SendAgreement_Methods.sendAgreement(tem.Id , acct.id );
}
}
public class SendAgreement_Methods {
@future (callout=true)
public static void sendAgreement(Id temId, Id acctId) {
try {
System.debug('Calling AgreementTemplateService.load: ' + temid + ' - ' + acctid);
echosign_dev1.AgreementTemplateService.load( temid , acctid );
} catch (Exception E) { System.debug('Exception: ' + e.getStackTraceString());}
}
}
And I've looked at the logs, and there are no errors at all. I compared the logs with what happens when you click on the button, adn they are same, up until a certain point, when the logs for the trigger just stop and the logs when clicking on the button just continue. Hard to tell exactly what is being executed though.
We are using the trigger based approach and calling echosign_dev1.AgreementTemplateService.load( templatedId , RecordId ). Hope you have set "Auto Send" checkbox on the agreement template. And the emails ids are correctly getting populated when an agreement is generated.
Thanks
Nidhi
It will be great if you post your code here.
Thanks,
Praveen K S