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

Formula for returning Days since Last Activity?

Hi All,


This is probably a really noob question, but I'm just getting my head around things.


I have created a formula field called DaysSinceLastActivity, which does this:


ROUND(TODAY()-LastActivityDate, 0)


This returns an integer number for days between today and the LastActivityDate. 


The problem I am having is that if my guys put in reminders - activities to contact a lead at a particular point in the future, my "DaysSince" field starts returning a negative number: it subtracts (Activity Due Date) from (Today). 


Is there a way to get this formula to ignore future dates altogether, and roll with LastActivityDate's that are in the past only? 


I thought about having it return 0 if the number is negative, but that is basically wrong too.




Thanks in advance!


Best Answer chosen by Admin (Salesforce Developers) 
Yeah, sounds like what I would do - good luck!

All Answers

What would you like to have happen when there are reminders? Salesforce controls what value is stored in LastActivityDate, so you can't make it work differently from how it works now, which is to store a future date when there are reminders.

Hi Jakester,


Thanks for the reply - yeah this is the part that sorta bent my brain. If SF only keeps one value in LastActivityDate, then it seems like there isnt a way to enumerate which is the last past activity - ie, the "Days since last activity".


Or am I going about this the wrong way - is there a better-practice way to get a value for days-since-last-activity? 


LastModificationDate is only updated when you change a field, correct? This wouldnt update if emails were appended to the activity list...right?


Maybe I have to live with it and tell my team what it means to have negative days since last activity...




Yeah, sounds like what I would do - good luck!
This was selected as the best answer