Hi Tim,
Here is a calc I wrote that gathers the "LatestUpdate" for my Incidents... it checks all Notes/Tasks/TaskNotes for whichever was added most recently. Feel free to adjust it to include With Customer and other objects as well.
import System
static def GetAttributeValue(Incident):
Value = ""
Current = Incident
try:
if Incident.Notes.Count>0:
Current = Incident.Notes.Latest()
LUtype="NOTE"
if Incident.Tasks.Count>0:
LatestTask = Incident.Tasks.Latest()
if LatestTask.CreationDate > Current.CreationDate:
Current = LatestTask
LUtype="TASK"
for t in Incident.Tasks:
if t.Notes.Count>0:
if t.Notes.Latest().CreationDate > Current.CreationDate:
Current = t.Notes.Latest()
LUtype="TASK.NOTE"
if LUtype == "TASK":
Snippet = Current.Description.Substring(0,500)
else:
Snippet = Current.Text.Substring(0,500)
Value = String.Format("<strong>[Update by {0}/{1}] ({2})::::</strong> {3}", Current.CreationUser.Title, LUtype, Current.Title, Snippet)
except e as Exception:
return Value
return Value