Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class DragAndDropController
public String bccAddresses {get; set;}
public String ccAddresses {get; set;}
public String toAddresses {get; set;}
public String caseId {get; set;}
public String caseIdChosen {get; set;}
public String contactIdToEmail {get; set;}
public String externalComments {get; set;}
public String htmlBody {get; set;}
public String subject {get; set;}
public String textBody {get; set;}
public DragAndDropController(ApexPages.StandardController controller)
controller.addFields(new List<String>{‘Id’});
caseIdChosen = controller.getId();
List<EmailMessage> emailMessages = [SELECT Id, bccAddress, ccAddress, htmlBody, subject, textBody, toAddress FROM EmailMessage WHERE Parent.Id =: caseIdChosen ORDER BY CreatedDate ASC LIMIT 1];
for (EmailMessage em : emailMessages)
bccAddresses = em.BccAddress;
ccAddresses = em.ccAddress;
htmlBody = em.HtmlBody;
subject = em.Subject;
textBody = em.TextBody;
toAddresses = em.ToAddress;
for (Contact contactsToAnalyse : [SELECT Id FROM Contact WHERE Email =: toAddresses LIMIT 1])
contactIdToEmail = contactsToAnalyse.Id;
public String goToEmailDragAndDrop()
String emailAuthorUI = URL.getSalesforceBaseUrl().toExternalForm() + ‘/_ui/core/email/author/EmailAuthor?p24=’ + toAddresses + ‘&p3_lkid=’ + caseIdChosen + ‘&p23=’ + textBody + ‘&p2_lkid=’ + contactIdToEmail + ‘&p4=’ + ccAddresses + ‘&p5=’ + bccAddresses + ‘&p6=’ + subject;
return emailAuthorUI;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.