function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brian StoiberBrian Stoiber 

Apex Trigger to copy one field to another

I am trying to write an Apex trigger that copies the contents of the Comments field that is used for emails into the Notes field used for Tasks. 
Egor Gerasimenko 9Egor Gerasimenko 9
Is there a specific error or problem you are running into? If you aren't sure where to start, check out https://trailhead.salesforce.com/en/content/learn/modules/apex_triggers/apex_triggers_intro
Brian StoiberBrian Stoiber
The problem I am having is in the classic activity history, the content of emails is not being shown. This is why I am trying to get a trigger that copies the contents of the email Comments field into the Notes field See image. 

User-added image
Egor Gerasimenko 9Egor Gerasimenko 9
That seems very doable, but I don't understand what your question is. What have you tried? Which part didn't work? Post the code you have written so far.
Brian StoiberBrian Stoiber
That is my problem. Relatively new to SF and not sure how to write that. I asked this question in answers.salesforce.com and they suggested posting it here. 

The question is. How do I write an Apex trigger that copies the contents of the Comments field that is used for emails into the Notes field used for Tasks?