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
Dhanalakshmi VellachamyDhanalakshmi Vellachamy 

Embed the DocuSign with the Email Notification sent using the APEX trigger

We currently have an approval process and when the Quote as an attachment to the customers when the Quotes is approved.
The APEX trigger is like
trigger approvalQuote on Quote(after update){ set<Id> quoteIdsApproved= new set<Id>(); set<Id> quoteIdsSOWupdates= new set<Id>(); for(Quote q: trigger.new){ quoteIdsSOWupdates.add(q.Id); system.debug('++++++++++++++2'); if(q.Status!=trigger.oldMap.get(q.Id).Status && q.Status=='Approved'){ quoteIdsApproved.add(q.Id); } } if(quoteIdsApproved.size()==1) approvalQuote_Handler.sendEmailAlert(quoteIdsApproved); approvalQuote_Handler.UpdateSOWStage(quoteIdsSOWupdates); }
And in the Handler we have
public class approvalQuote_Handler{ @future public static void sendEmailAlert(set<id> quoteIds){ List<Quote> QuoteLst=[Select Id,Contact.Id,Contact.Email, OwnerId From Quote where id IN :quoteIds]; string emailId=QuoteLst[0].Contact.Email; Id contactId= QuoteLst[0].ContactId; for(Id quoteId: quoteIds){ List<Attachment> attachments = [SELECT Id,Name, Body, ContentType FROM Attachment WHERE ParentId = :quoteId ORDER BY CreatedDate DESC LIMIT 1]; List<Messaging.EmailFileAttachment> email_attachments = new List<Messaging.EmailFileAttachment>(); for(Attachment att : attachments){ Messaging.EmailFileAttachment email_att = new Messaging.EmailFileAttachment(); email_att.setBody(att.Body); email_att.setContentType(att.ContentType); email_att.setFileName(att.Name); email_att.setinline(false); email_attachments.add(email_att); } //generate email here like Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); Id template_id = [SELECT id, name FROM EmailTemplate WHERE developername = 'Quote_Template'].Id; string [] toAddresses=new string[1]; toAddresses[0]=emailId; email.setToAddresses(toAddresses); // Quote contact Email Id //email.setCcAddresses(to_cc_receivers); //list of email addresses email.setTargetObjectId(contactId); //Id of Lead, User or Contact if that is target object. not required email.setWhatId(quoteId); //Id of object that should do field merge email.settemplateid(template_id); email.setFileAttachments(email_attachments); Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); } } }
I am new Docusign and I am not sure how can I embed the Docusign piece in to the sendEmailAlert() so the Attachment allows the users to sign it.