+ Start a Discussion
Ido Greenbaum 10Ido Greenbaum 10 

Handling Inline Images of the Email Content from Email-to-Case

I am trying to workaround the lack of inline images in a custom rich text field I created named 'Description_HTML__c', using the article below: http://www.mstsolutions.com/blog/content/handling-inline-images-email-content-email-case#comment-4

I created an Apex Class:
public class getHtmlHandler{
static list<case> caseList = new list<case>();
@future
public static void processEmailMessage(List<Id> emailMsgIds){
    for(EmailMessage em : [SELECT Id, ParentId, HtmlBody FROM emailMessage WHERE Id IN: emailMsgIds]){
        case cc = new case();
    cc.id = em.ParentId;
    cc.Description_HTML__c = em.HtmlBody;
    caseList.add(cc);
}
update caseList;
}
}


And a Trigger on EmailMessage:
trigger HandlingHtmlContent on EmailMessage (before insert) {
    List<Id> emailMsgId = new List<Id>();
    for(EmailMessage em : Trigger.New){
    emailMsgId.add(em.id);
    }
    getHtmlHandler.processEmailMessage(emailMsgId);
}


This doesn't seem to be working. The customer Rich-Text field 'Description_HTML__c' is left empty.