2 Replies Latest reply on Jun 26, 2017 9:23 PM by James.C

    Inserting Last Journal.Note into Email Notifications

    James.C Rookie


      I am trying to include the latest journal.note to Incident, ServiceReq and Task email notifications but I am not having any luck due to the many to one relationship. Does anyone know a solution to this? I am ok with including all journal.notes if that's even possible.  Thanks!

        • 1. Re: Inserting Last Journal.Note into Email Notifications
          ben.prinsloo1 Apprentice

          There are more than one way of doing this.


          You will need to create a rule on Journal.Email and Journal.Notes to deal with Incident, ServiceReq etc individually based on the parentlink_category. This will require a few steps:

          1. Create an HTML field on Incident etc that will hold the last Note created (Lets call it LastNoteForCustomer)

          2. On Journal.Notes (You can do the same for emails if you want the latest email), create a trigger which sets this field on the parent if the parentlink_category is "Incident" (For emails check that the incoming email is not the same as the listener, or the email of the customer). The condition could resemble the following :

          $(ParentLink_Category == "Incident")

          If you want to do this on Emails, you need it slightly more sophisticated (It can be improved with regex expressions, and I added the sendmailattemps because I had an issue with an email server).

          $(Find(Trim(ToLowerCase([Incident#.]Email)), Trim(ToLowerCase(FromAddr))) > -1 &&
          ParentLink_Category == "Incident" && nvl(SendMailAttempts, 0) < 1)

          3. Create a calculation rule on "Parentlink_category" setting the EmailBody field as with this sample on Journal.Email:


          $(if ParentLink_Category == "Incident" && Len(EmailBody) < 1
          then "<font face=arial >" +
          "</br><br/></br><b> Original issue raised on " + [Incident#.]CreatedDateTime +
          ":</b> </br></br>" + [Incident#.]Symptom + " </br><br/></br> Last Note:</br><br/>" + 

          else "")

          The above should set the email reply to the original issue and the last email raised.


          Btw. I wrote the above on the fly while typing this (Only the email condition I copied), so there might be a warning here or there which I might have missed. It can be improved on.


          You can use variations on this to append to the Email content on Incident using Rollups to get a full audit trail. The above is the simplest way which works for most cases.

          2 of 2 people found this helpful
          • 2. Re: Inserting Last Journal.Note into Email Notifications
            James.C Rookie

            Thanks Ben! This is extremely helpful. I'll test this in our staging tenant.