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
SteveMouSteveMou 

Trigger to rate Contacts based on Activity History

Does anyone have any ideas on how to create a field on the Contact page that would be some sort of Gauge ranking a contact as Hot, Warm, Cold based on how recent the last Activity History record was?

 

For example if a contact has Activity History in the past 30 days the field or gauge would say "Hot".

 

Would an Apex Trigger accomplish this?

 

Any thoughts or help is greatly appreciated.

 

Thanks!!

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

I'm not sure a formula field will allow you to check last activity history. Unless you only care about lastmodifieddate.

 

Apex trigger would certainly do the trick, though.

All Answers

CodeFinderCodeFinder

Try a formula field. that shud work for this.

spraetzspraetz

I'm not sure a formula field will allow you to check last activity history. Unless you only care about lastmodifieddate.

 

Apex trigger would certainly do the trick, though.

This was selected as the best answer
SteveMouSteveMou

I think I got it to work using the below formula field. There was a "LastActivityDate" field available in the contact table that seems to be based on the Start Date of any Event or Task a user creates. Now the question is how can I turn this simple formula field displayed into some sort of gauge on the Contact screen that would show Hot/Med/cold in Red, Orange, and green. Very similar to the Dashboard Gauge that SFDC offers.

 

If (Today() - LastActivityDate >=60, "Cold",
If (Today() - LastActivityDate >=30, "Warm",
If (Today() - LastActivityDate <30, "Hot", "Not Valid")))

spraetzspraetz

I believe there is an IMAGE() function in the formula editor where you can input an image URL.