0

Perhaps it isn't possible, but I find it strange that autogenerated EmailMessage records are bucketed into the correct month, but manually inserted EmailMessage records show up as "Upcoming & Overdue"

When comparing fields behind the scenes, the values of the fields look almost identical between a manually inserted EmailMessage record and a autogenerated one by Salesforce. (Yes, even MessageDate is populated on both.)

Any idea how to properly categorize the manually inserted records within the Activities Timeline in the Lightning Page Layout, so they fall within their designated month?

enter image description here

For those that are curious the one that does bucket by the month, I'm using out of the box Flow "Send Email"

The one that is not bucketing by month and showing under Upcoming & Overdue I insert like so:

    EmailMessage newEmail = new EmailMessage();
    newEmail.ToAddress = ...
    newEmail.CcAddress = ...
    newEmail.Subject = email.subject;
    newEmail.TextBody = email.plainTextBody;
    newEmail.HtmlBody = email.htmlBody;
    newEmail.MessageDate = system.now();
    newEmail.RelatedToId = ...
    insert newEmail;

1 Answer 1

0

Found this in the EmailMessage documentation. Looks like Status = '5' (Draft)

Should really manually be set to Status = '4' (Forwarded)

That will categorize it correctly.

        newEmail.Subject = email.subject;
        newEmail.TextBody = email.plainTextBody;
        newEmail.HtmlBody = email.htmlBody;
        newEmail.MessageDate = system.now();
        newEmail.Status = '4';

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .