You need to sign in to do that
Don't have an account?
Elad Kaplan 3
Email Message Status event
I want to update some fields on a case related to an email message, when the email message status changes, the problem is, that the status change doesn't triggers anything (trigger or workflow), I also can't create a custom object to look up to an Email message.
Anyone has a work around i can do ?
Anyone has a work around i can do ?
trigger ProcessStatusChanges on EmailMessage (after update) {
for (EmailMessage m : trigger.new) {
//check if the status changed
if (trigger.newMap.get(m.Id).Status != trigger.oldMap.get(m.Id).Status) {
//do stuff
}
}
}
http://salesforce.stackexchange.com/questions/16795/trigger-on-case-emailmessage (http://salesforce.stackexchange.com/questions/16795/trigger-on-case-emailmessage" target="_blank)
The EmailMessage Status change, doesn't fire the trigger update event..
That's how the trigger looks like :
trigger trg_EmailMessage on EmailMessage (before insert, after insert, before update, after update, before delete, after delete) {
cls_TriggerFactory.createHandler(cls_TriggerFactory.TriggerHandler.TH_EMAIL_MESSAGE);
}
The trigger calls a class that performes the logic, however, as I've mentioned, the trigger doesn't get fired on EmailMessage update event..
public void setUnreadEmailFlagTrue(EmailMessage message)
{
if (message.Status != null && message.Status.EqualsIgnoreCase('0')
&& message.Incoming != false && message.ParentId != null)
{
String ParentIdStr = String.valueOf(message.ParentId);
if(ParentIdStr.startsWith('500'))
{
Case theCase = new Case(Id = message.ParentId);
theCase.Has_Unread_Emails__c = true;
db_manager.append(theCase);
}
}
}
cls_TriggerFactory.createHandler(cls_TriggerFactory.TriggerHandler.TH_EMAIL_MESSAGE);
but you have not posted it. Could you post all of the code that this trigger runs?
@Elad Kaplan 3
Have you find the answer to your problem?
thks