• Chris McFarling
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
The Activity History related list can show four types of items - Event, Email, Call, Task. In the database schema the Event, Call and Task objects are all lumped together so to speak and classified as Activities. The EmailMessage object, where outgoing emails live, is the adopted child as far as Activity History goes.

If you want a custom field column to show in the Activity History related list, you add a field to Activity Custom Fields. The system then automatically associates that custom field with a Call, Task or Event, but not with an EmailMessage. The EmailMessage object, being disconnect from the other activity types, has it's own custom fields. So you can add a custom field to the EmailMessage object, unfortunately there's no way to display it, as far as I can tell, in the activity history related list.

For example, I want a custom field named Consultant to be displayed for calls, tasks, events as well as email messages. I added a Consultant field to Activity Custom Fields as well as the EmailMessage object. As you can see, unfortunately the Activy History related list is only smart enough to show the Consultant Custom field for activity type items and not email messages. Is there a workaround or some other way to make this happen perhaps?
User-added image
I want to relate an outbound email message to a different Opportunity. EmailMessage.RelatedToId holds the Id of the Opportunity for which it's related to. I attempted to simply change the RelatedToId on the EmailMessage using Execute Anonymous but it doesn't work. Getting error "System.SObjectException: Field is not writeable: EmailMessage.RelatedToId".
 
EmailMessage msg=[SELECT Id, RelatedToId FROM EmailMessage WHERE Id = '02so000000I7rXuAAJ'];
msg.RelatedToId='006o000000NJzV1AAL';
Update msg;

Is there another method of updating this field?
 
The Activity History related list can show four types of items - Event, Email, Call, Task. In the database schema the Event, Call and Task objects are all lumped together so to speak and classified as Activities. The EmailMessage object, where outgoing emails live, is the adopted child as far as Activity History goes.

If you want a custom field column to show in the Activity History related list, you add a field to Activity Custom Fields. The system then automatically associates that custom field with a Call, Task or Event, but not with an EmailMessage. The EmailMessage object, being disconnect from the other activity types, has it's own custom fields. So you can add a custom field to the EmailMessage object, unfortunately there's no way to display it, as far as I can tell, in the activity history related list.

For example, I want a custom field named Consultant to be displayed for calls, tasks, events as well as email messages. I added a Consultant field to Activity Custom Fields as well as the EmailMessage object. As you can see, unfortunately the Activy History related list is only smart enough to show the Consultant Custom field for activity type items and not email messages. Is there a workaround or some other way to make this happen perhaps?
User-added image
I want to relate an outbound email message to a different Opportunity. EmailMessage.RelatedToId holds the Id of the Opportunity for which it's related to. I attempted to simply change the RelatedToId on the EmailMessage using Execute Anonymous but it doesn't work. Getting error "System.SObjectException: Field is not writeable: EmailMessage.RelatedToId".
 
EmailMessage msg=[SELECT Id, RelatedToId FROM EmailMessage WHERE Id = '02so000000I7rXuAAJ'];
msg.RelatedToId='006o000000NJzV1AAL';
Update msg;

Is there another method of updating this field?
 
The Activity History related list can show four types of items - Event, Email, Call, Task. In the database schema the Event, Call and Task objects are all lumped together so to speak and classified as Activities. The EmailMessage object, where outgoing emails live, is the adopted child as far as Activity History goes.

If you want a custom field column to show in the Activity History related list, you add a field to Activity Custom Fields. The system then automatically associates that custom field with a Call, Task or Event, but not with an EmailMessage. The EmailMessage object, being disconnect from the other activity types, has it's own custom fields. So you can add a custom field to the EmailMessage object, unfortunately there's no way to display it, as far as I can tell, in the activity history related list.

For example, I want a custom field named Consultant to be displayed for calls, tasks, events as well as email messages. I added a Consultant field to Activity Custom Fields as well as the EmailMessage object. As you can see, unfortunately the Activy History related list is only smart enough to show the Consultant Custom field for activity type items and not email messages. Is there a workaround or some other way to make this happen perhaps?
User-added image