How to customize WorkflowGen notification subject lines

Background

You can customize the email subject line for outgoing notifications. Otherwise, WorkflowGen dynamically generates one for you based on the following information:

  • Process name
  • Request number
  • Event
  • Current action name

This would generate a subject line such as: HELP_DESK #1440 - New action to assign: 4-OPERATION_LEVEL_1.

Solution

Since all notifications from WorkflowGen are generated from a template, these templates can be modified to explicitly specify a subject. Since the default email message templates (located in \wfgen\App_Data\Templates\Emails) are used system-wide, any changes to the templates could affect all processes. This is why the default templates do not have explicit subject lines and instead rely on WorkflowGen to generate them.

If you want to customize your email subject line, the best practice is to create a custom email template specific to a process. However, if you choose to modify your default templates, the method to do this is the same. Templates can be created in HTML or as plain text and can include WorkflowGen macros to display process-specific information.

For more information on how to create custom templates, see the Custom notification templates section in the WorkflowGen Administration Module Reference Guide

To create a custom subject line in your template, add the SUBJECT: keyword followed by the text you want to display as the first line of the template.

For example:

SUBJECT: This is my custom subject line.

WorkflowGen macros that are used within the email body can also be used within the subject line.

For example:

SUBJECT: <WF_PROCESS_INST_NAME> #<WF_PROCESS_INST_ID> - Request Pay Rate Change for <WF_PROCESS_INST_RELDATA_VALUE.EMP_FIRSTNAME> <WF_PROCESS_INST_RELDATA_VALUE.EMP_LASTNAME> - Request Closure

would be rendered as:

PAY_RATE #1234 - Request Pay Rate Change for John Smith - Request Closure

Below is a sample custom email template with a custom subject line:

SUBJECT: Pay Rate Change Request for <WF_PROCESS_INST_RELDATA_VALUE.EMP_FIRSTNAME>
 <WF_PROCESS_INST_RELDATA_VALUE.EMP_LASTNAME> - Denied by Human Resources 

<html>
   <head>
      <meta http-equiv=Content-Type content=text/html; charset=UTF-8>
      <title>Pay Rate Change Request Denied by Human Resources</title>
      <style type="text/css">
         body
         {
         font-family:Arial, Helv;margin:0px;
         }
         .Header {width:100%;padding:0px;margin:0px;white-space:nowrap;border-bottom: solid 1px #D3D3D1;border-top: solid 1px #D3D3D1;}
         .Header .Title {line-height:45px;padding-left:11px;font-size: 19px;color: #4C4C4C;font-weight: bold;font-family:Tahoma, Arial;text-align:left;backgroundcolor:#F9F9F9;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FEFEFE', EndColorStr='#F4F4F4')}
         .Content {border:0px;margin-left:40px;margin-top:10px;}
         .Content .FieldLabel {font-size: 12px;font-weight:bold;text-align:right;}
         .Content .FieldValue {font-size: 12px;font-weight:normal;text-align:left;color:#000000;}
         .Content .FieldValue .Link {text-decoration:underline;color:#00309C;}
         .Content .FieldValue .Link:hover {text-decoration:underline;}
         .Content .FieldValue .Link:visited {color:#00309C;text-decoration:underline;}
         .DataList {margin-left:40px;margin-top:15px;width:600px;font-size: 11px;border-style: solid;border-collapse:collapse;border-width: 1px 1px 1px 1px;border-color: #D5D5D5;}
         .DataList .Header {font-weight:bold;color:#4C4C4C;padding: 3px;border-style: solid;border-width: 1px 1px 1px 1px;border-color: #D5D5D5;font-family:Tahoma;white-space: nowrap;padding-left:6px;text-align: left;background-color:#EAEAEA;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FEFEFE', EndColorStr='#EAEAEA')}
         .DataList .ListRow {height:22px;}
         .DataList .ListRow .FieldLabel {font-size: 12px;color:#000000;background-color:#FFFFFF;font-weight: normal;width:250px;padding-left: 5px;border-collapse:collapse;border-style: solid;border-width: 0px 0px 1px 1px;border-color: #D5D5D5;}
         .DataList .ListRow .FieldValue {font-size: 12px;color:#000000;text-align:right;padding-right:5px;background-color:#FFFFFF;border-style: solid;border-collapse:collapse;border-width: 0px 1px 1px 0px;border-color: #D5D5D5;}
         .DataList .ListRow .FieldValue .Link {text-decoration:underline;color:#00309C;}
         .DataList .ListRow .FieldValue .Link:hover {text-decoration:underline;}
         .DataList .ListRow .FieldValue .Link:visited {color:#00309C;text-decoration:underline;}
         .DataList .ListRowHighLight {height:22px;background-color:#FFF0E5;}
         .DataList .ListRowHighLight .FieldLabel {font-size: 12px;color:#000000;font-weight: normal;width:250px;padding-left: 5px;border-collapse:collapse;border-style: solid;border-width: 0px 0px 1px 1px;border-color: #D5D5D5;}
         .DataList .ListRowHighLight .FieldValue {font-size: 12px;color:#000000;text-align:right;padding-right:5px;border-style: solid;border-collapse:collapse;border-width: 0px 1px 1px 0px;border-color: #D5D5D5;}
         .DataList .ListRowHighLight .FieldValue .Link {text-decoration:underline;color:#00309C;}
         .DataList .ListRowHighLight .FieldValue .Link:hover {text-decoration:underline;}
         .DataList .ListRowHighLight .FieldValue .Link:visited {color:#00309C;text-decoration:underline;}
      </style>
   </head>
   <body>
      <p>
         Human Resources - Denial of Pay Rate Change
      </p>
      <table class="Header" cellpadding="0" cellspacing="0">
         <tr>
            <td class="Title">
               <WF_PROCESS_INST_NAME>
            </td>
         </tr>
      </table>
      <table class="Content">
         <tr>
            <td>
               Human Resources Decision - Request Denied
            </td>
         </tr>
         <tr>
            <td class="FieldLabel">Date of Denial :</td>
            <td class="FieldValue">
               <WF_SYSTEM_DATETIME>
            </td>
         </tr>
         <tr>
            <td class="FieldLabel">Action :</td>
            <td class="FieldValue">
               <WF_ACTIVITY_INST_NAME>
            </td>
         </tr>
         <tr>
            <td class="FieldLabel">Description :</td>
            <td class="FieldValue">
               <WF_ACTIVITY_INST_DESC>
            </td>
         </tr>
         <tr>
            <td class="FieldLabel">Link :</td>
            <td class="FieldValue">
               <a class="Link" href="<WF_LINK_ACTIVITY_INST_FORM>">View action</a>
            </td>
         </tr>
      </table>
      <p>
         The "Pay Change Request" for 
         <WF_PROCESS_INST_RELDATA_VALUE.EMP_FIRSTNAME>
         <WF_PROCESS_INST_RELDATA_VALUE.EMP_LASTNAME>
         with a Current Pay Rate of 
         <WF_PROCESS_INST_RELDATA_VALUE.EMP_CURRENT_PAY_RATE>
         and a new Changed Pay Rate Request of 
         <WF_PROCESS_INST_RELDATA_VALUE.EMP_REQUESTED_PAY_RATE>
         has been denied by Human Resources.
      </p>
      <p>
         The reasons for this denial are: 
         <WF_PROCESS_INST_RELDATA_VALUE.HR_COMMENTS>
      </p>
      <p>
         To discuss this denial with Human Resources, please contact your Human Resources representative 
         <WF_PROCESS_INST_RELDATA_VALUE.HR_REP>
         at 
         <WF_PROCESS_INST_RELDATA_VALUE.HR_REP_PHONE>
         or via email at 
         <WF_PROCESS_INST_RELDATA_VALUE.HR_REP_EMAIL>
         .
      </p>
   </body>
</html>