Notes are already supposed to use "ToLocalTime" but for some reason, adding it to the calculation seems to have helped. I'll be testing some more, but this rev appears to work in WebDesk.
import System static def GetAttributeValue(Incident): Value = 'Most recent note or With Customer details:' Value += '\n' if Incident.Status.Title == 'With Customer': if Incident.Notes.Latest() != null: if Incident._WithCustomerCol.Latest()._Createdon.ToLocalTime() > Incident.Notes.Latest().CreationDate.ToLocalTime(): Value += Incident._WithCustomerCol.Latest()._Details else: Value += Incident.Notes.Latest().Text else: Value += Incident._WithCustomerCol.Latest()._Details elif Incident.Status.Title != 'With Customer': if Incident._BackFromCustomerCol.Latest() != null and Incident.Notes.Latest() != null: if Incident._BackFromCustomerCol.Latest()._Createdon.ToLocalTime() > Incident.Notes.Latest().CreationDate.ToLocalTime(): Value += Incident._BackFromCustomerCol.Latest()._Description else: Value += Incident.Notes.Latest().Text elif Incident._BackFromCustomerCol.Latest() == null and Incident.Notes.Latest() != null: Value += Incident.Notes.Latest().Text elif Incident._BackFromCustomerCol.Latest() != null and Incident.Notes.Latest() == null: Value += Incident._BackFromCustomerCol.Latest()._Description else: Value += 'No recent notes' else: Value += 'No recent notes' return Value