3
Vote

Template for email notification

description

Provide mechanism for admin to customize the email format and content when emaling ticket status. Expose all ticket header/detail data fields as tokens for use in email templates.

comments

adefwebserver wrote Apr 17, 2011 at 1:46 AM

I think that the users who really need this, know how to open up the code and make the needed changes. While power user appreciate token driven emails and screen layouts, ADefHelpDesk is designed to be easy and simple to configure and operate.

I believe that this featured should be considered after we have the Silverlight version out, because then we can implement this without the user having to carefully insert a token correctly. Perhaps a interface that allows you to drag the token onto the text editor (and you would see sample text not a "[UsersName]" token.

(the Silverlight version is still sitting half completed. It's current delay is that I have to release a LightSwitch and DotNetNuke tutorial first)

mcsenow wrote Apr 20, 2011 at 4:40 AM

Below is an example email template in the resource file. This template allows to the assignee to see detail information about the ticket.

Attention IT Service Desk Admin,

Service desk ticket [TaskID] has been assigned to you. Please provide assistance to the Requester.

TICKET SUMMARY:

   Ticket: [TaskID]
   Created Date: [CreatedDate]
   Requester: [Requestor]
   Email: [Email]
   Phone: [Phone]
   Due Date: [DueDate]
   Priority: [PriorityName]
   Description: [Description]
   Details: [Details]

InDyne IT Service Desk
Phone: (703) 903-6927
Email: itservicedesk@indyneinc.com
Web: https://intranet.indyneinc.com

Below is the token replace code. It takes the email template as input and replace the token accordingly. Notice that there are separated methods to get ticket Description and ticket Detail (lastest comment) #region ReplaceTicketToken public static string ReplaceTicketToken(string strBody, string strPasswordLinkUrl, ADefHelpDesk_Task objADefHelpDesk_Tasks) { DotNetNuke.Entities.Portals.PortalSettings objPortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings(); //TaskID if (strBody.Contains("[TaskID]")) { strBody = strBody.Replace("[TaskID]", objADefHelpDesk_Tasks.TaskID.ToString()); } //PasswordLinkUrl if (strBody.Contains("[PasswordLinkUrl]")) { strBody = strBody.Replace("[PasswordLinkUrl]", strPasswordLinkUrl); } //Description if (strBody.Contains("[Description]")) { strBody = strBody.Replace("[Description]", objADefHelpDesk_Tasks.Description); } //Details if (strBody.Contains("[Details]")) { strBody = strBody.Replace("[Details]", GetDetailsOfTicket(objADefHelpDesk_Tasks.TaskID)); } //Comments if (strBody.Contains("[Comments]")) { strBody = strBody.Replace("[Comments]", GetCommentsOfTicket(objADefHelpDesk_Tasks.TaskID)); } //Requestor if (strBody.Contains("[Requestor]")) { strBody = strBody.Replace("[Requestor]", objADefHelpDesk_Tasks.RequesterName); } //Priority Name if (strBody.Contains("[PriorityName]")) { strBody = strBody.Replace("[PriorityName]", objADefHelpDesk_Tasks.Priority); } //Email if (strBody.Contains("[Email]")) { strBody = strBody.Replace("[Email]", GetEmailOfRequestor(objADefHelpDesk_Tasks.RequesterUserID, objADefHelpDesk_Tasks.RequesterEmail)); } //CreatedDate if (strBody.Contains("[CreatedDate]")) { strBody = strBody.Replace("[CreatedDate]", objADefHelpDesk_Tasks.CreatedDate.ToShortDateString()); } //DueDate if (strBody.Contains("[DueDate]")) { if (objADefHelpDesk_Tasks.DueDate.HasValue) { strBody = strBody.Replace("[DueDate]", objADefHelpDesk_Tasks.DueDate.Value.ToShortDateString()); } else { strBody = strBody.Replace("[DueDate]", string.Empty); } } //Phone if (strBody.Contains("[Phone]")) { strBody = strBody.Replace("[Phone]", objADefHelpDesk_Tasks.RequesterPhone); } //Assigned if (strBody.Contains("[Assigned]")) { strBody = strBody.Replace("[Assigned]", GetGetAssignedRoleName(objADefHelpDesk_Tasks.AssignedRoleID)); } //StatusName if (strBody.Contains("[StatusName]")) { strBody = strBody.Replace("[StatusName]", objADefHelpDesk_Tasks.Status); } //StartDate if (strBody.Contains("[StartDate]")) { if (objADefHelpDesk_Tasks.EstimatedStart.HasValue) { strBody = strBody.Replace("[StartDate]", objADefHelpDesk_Tasks.EstimatedStart.Value.ToShortDateString()); } else //blank out token { strBody = strBody.Replace("[StartDate]", string.Empty); } } //EstimatedHours if (strBody.Contains("[EstimatedHours]")) { if (objADefHelpDesk_Tasks.EstimatedHours.HasValue) { strBody = strBody.Replace("[EstimatedHours]", objADefHelpDesk_Tasks.EstimatedHours.Value.ToString()); } else //blank out token { strBody = strBody.Replace("[EstimatedHours]", string.Empty); } } //CompleteDate if (strBody.Contains("[CompleteDate]")) { if (objADefHelpDesk_Tasks.EstimatedCompletion.HasValue) { strBody = strBody.Replace("[CompleteDate]", objADefHelpDesk_Tasks.EstimatedCompletion.Value.ToShortDateString()); } else //blank out token { strBody = strBody.Replace("[CompleteDate]", string.Empty); } } return strBody; } // InDyne Customization - get detail #region GetDetailsOfTicket static string GetDetailsOfTicket(int TaskId) { string strDescription = ""; ADefHelpDeskDALDataContext objADefHelpDeskDALDataContext = new ADefHelpDeskDALDataContext(); ADefHelpDesk_TaskDetail objADefHelpDesk_TaskDetail = (from ADefHelpDesk_TaskDetails in objADefHelpDeskDALDataContext.ADefHelpDesk_TaskDetails where ADefHelpDesk_TaskDetails.TaskID == TaskId where (ADefHelpDesk_TaskDetails.DetailType == "Comment" || ADefHelpDesk_TaskDetails.DetailType == "Comment-Visible") orderby ADefHelpDesk_TaskDetails.DetailID select ADefHelpDesk_TaskDetails).FirstOrDefault(); if (objADefHelpDesk_TaskDetail != null) { strDescription = objADefHelpDesk_TaskDetail.Description; } return strDescription; } #endregion #region GetCommentsOfTicket static string GetCommentsOfTicket(int TaskId) { string strComments = ""; ADefHelpDeskDALDataContext objADefHelpDeskDALDataContext = new ADefHelpDeskDALDataContext(); ADefHelpDesk_TaskDetail objADefHelpDesk_TaskDetail = (from ADefHelpDesk_TaskDetails in objADefHelpDeskDALDataContext.ADefHelpDesk_TaskDetails where ADefHelpDesk_TaskDetails.TaskID == TaskId where (ADefHelpDesk_TaskDetails.DetailType == "Comment" || ADefHelpDesk_TaskDetails.DetailType == "Comment-Visible") orderby ADefHelpDesk_TaskDetails.DetailID descending select ADefHelpDesk_TaskDetails).FirstOrDefault(); if (objADefHelpDesk_TaskDetail != null) { strComments = objADefHelpDesk_TaskDetail.Description; } return strComments; } #endregion #region GetEmailOfRequestor static string GetEmailOfRequestor(int RequesterUserID, string RequesterEmail) { string strEmail = ""; if (RequesterUserID == -1) { try { strEmail = RequesterEmail; } catch (Exception) { // User no longer exists strEmail = ""; } } else { try { DotNetNuke.Entities.Portals.PortalSettings objPortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings(); strEmail = DotNetNuke.Entities.Users.UserController.GetUserById(objPortalSettings.PortalId, RequesterUserID).Email; } catch (Exception) { // User no longer exists strEmail = ""; } } return strEmail; } #endregion #region GetAssignedRoleName static string GetGetAssignedRoleName(int AssignedRoleID) { string strAssignedRoleName = ""; if (AssignedRoleID > -1) { try { DotNetNuke.Security.Roles.RoleController objRoleController = new DotNetNuke.Security.Roles.RoleController(); DotNetNuke.Entities.Portals.PortalSettings objPortalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings(); strAssignedRoleName = String.Format("{0}", objRoleController.GetRole(AssignedRoleID, objPortalSettings.PortalId).RoleName); } catch (Exception) { // User no longer exists strAssignedRoleName = ""; } } return strAssignedRoleName; } #endregion #endregion

adefwebserver wrote Apr 20, 2011 at 1:17 PM

I do like the template in the resouce file. Of course it needs to be localized. I will plan for it in the next release.

wrote Apr 20, 2011 at 1:18 PM

wrote Feb 6, 2012 at 10:16 PM

wrote Feb 14, 2013 at 6:27 PM

wrote Apr 26, 2013 at 5:53 AM