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
Annabelle BlackburnAnnabelle Blackburn 

Apex Trigger for Activity Subject

Hi there,

I'm looking to create a field that automatically populates with the Latest Activity Subject. When pulling reports I need to be able to see the latest activity subject and in the out-of-the-box Salesforce you only have access to Latest Activity Date.

From looking around it seems the only way to do this is to create an apex trigger that will populate a Latest Activity Subject field that I create. I'm fairly new to Salesforce and would really appreciate some A-Z guidance on how to best create this.

Thanks!
Best Answer chosen by Annabelle Blackburn
Baktash HossainzadehBaktash Hossainzadeh
Great. Try it with the Process Builder. If that doesn't work you probably will need an Apex Trigger. Let us now if it worked!

All Answers

Baktash HossainzadehBaktash Hossainzadeh
Hello Annabelle,

on which Object do you want to put that field with the "Latest Activity Subject".
My approach would be to create a Process, which updates that Object anytime the "Latest Activity Date" has changed.

Best regards,
Baktash Hossainzadeh 
Annabelle BlackburnAnnabelle Blackburn
Hi Baktash, Thanks for your response. That sounds as valid an approach as any! I'd like it to be on the Contact page. Best, Annabelle
Baktash HossainzadehBaktash Hossainzadeh
Great. Try it with the Process Builder. If that doesn't work you probably will need an Apex Trigger. Let us now if it worked!
This was selected as the best answer