5 Replies Latest reply on Mar 9, 2017 7:18 AM by csoto

    How can I create an "Update Stream" that lists all Notes, Attachments, Resolutions, UnResolves, etc.?

    csoto Specialist

      Right now, I have this Before Save Calculation (String, -1) that produces a "Notes Stream" that is used in email notifications to Analysts and End Users:


      import System  
      static def GetAttributeValue(Incident):
          Value = ""
          if Incident.Notes.Count > 0:
              SortedNotes = List(Incident.Notes as Collections.IEnumerable)
              SortedNotes.Sort() do (first, last):
                  return last.CreationDate.CompareTo(first.CreationDate)
              Value = "<TABLE BORDER=1 WIDTH=100%><TR><TH COLSPAN=3>Notes:</TH></TR>"
              for Note in SortedNotes:
                  Value += "<TR><TD>"+ Note.CreationDate.ToLocalTime() + "</TD>"
                  Value += "<TD>"+ Note.RaiseUser.Title + "</TD>"
                  Value += "<TD>"+ Note.Text + "</TD></TR>"
              Value += "</TABLE>"
          return Value


      You'll see that I have to reverse-sort the Notes so that they show up in the proper order (based on Notes.CreationDate). Output looks something like:



      2/14/2017 11:07:26 AM
      Smith, Analyst P
      Mary had a little lamb, who's fleece was white as snow.


      This is great for processes for which only Notes are added.


      I would like to generate a similar "stream" that includes the Date, RaiseUser and Text for any Attachments, Resolutions, UnResolves, With3rdParty, BackFrom3rdParty, etc.and have these sorted chronologically within this one stream. Would anyone have a calculation that does something similar?