Quick and easy way to automatically populate the Subject of Journal.Emails with the Incident or Service Request number

Version 1

    Details

    The following expression accounts for the Journal being sent from either a Service Request or Incident, or a task associated with one of those parent objects, and will populate the subject automatically, accordingly. This approach could be extended to include other parent object types, or be modified for use with other fields such as ToAddrList


    Resolution

     

    Create an Editing rule on the Journal.Email object: "On change of ParentLink_RecID, set Subject":



    $(if nvl(Subject,  "") == ""
      then if ParentLink_Category == "Incident"
           then "Incident# " + ToString([Incident#.]IncidentNumber) + " - " +
                [Incident#.]Subject
           else if ParentLink_Category == "ServiceReq"
                then "Service Request# " + ToString([ServiceReq#.]ServiceReqNumber) +
                     " - " + [ServiceReq#.]Subject
                else if [Task#Assignment.]ParentLink_Category == "ServiceReq"
                     then "Service Request# " +
                          ToString([Task#Assignment.][ServiceReq#.]ServiceReqNumber) +
                          " - " + [Task#Assignment.][ServiceReq#.]Subject
                     else if [Task#Assignment.]ParentLink_Category == "Incident"
                          then "Incident# " +
                               ToString([Task#Assignment.][Incident#.]IncidentNumber
                                            ) +
                               " - " + [Task#Assignment.][Incident#.]Subject
                          else Subject
      else Subject)