This project has moved and is read-only. For the latest updates, please go here.

Email Notifications

Mar 3, 2009 at 8:36 PM
I've got ticketdesk up and runing, and I've enabled email notifications.  At this time, email notifications for new tickets seem to go out to all individuals who are part of the AD group assigned to the "HelpDeskStaffRoleName" within the web.config?  Is there a way to disable this notification on new ticket creation?  

I still want to use the email notifications, especially for notifying end users that their ticket has been updated, but I don't want all the helpdesk staff to be notified every time there is a ticket  For example, second level support staff don't need a notice until the ticket is assigned to them.

Ideally I'd notify the helpdesk staff of new ticket creation through the RSS feeds...  Therefore I don't need notice on new ticket creation, however it seems like the email config is all or nothing at this point?

Mar 4, 2009 at 1:21 PM
You are correct, it is pretty much all or nothing at this point. Fortunatly, it is an open source project, and the change you want to make is rather minor. You can just comment out the block in Ticket.cs on or around line 92 - 102 and you will have eliminated the new ticket notifications. 

Mar 4, 2009 at 6:28 PM
One of the greatest benefits of open source is that anyone can make such changes at the source level...

One of the greatest follies with open source is assuming everyone is a developer and has the understanding and wherewithall to make such changes. 

I've done vbscript and powershell scripting, and just the tiniest bit of VB.Net development.  Sounds like I can handle commenting out some lines though.  Probaby would've had a bugger of a time finding them without the pointer thuogh... Thanks.  Now I've just got to download the free version of the VS.Net developer tools to get it done.  Never had a need for them on my current machine.  :)
Mar 4, 2009 at 9:49 PM
I spent my first 7 years in IT as a Systems Admin / Network Admin so I know where you are coming from there :)

If you run into any problems with source changes just send me a message directly and I'll arrange an FTP drop with those modificactions for you. 
Mar 4, 2009 at 9:56 PM
Edited Mar 5, 2009 at 3:50 PM

Thanks, Stephen…  I was actually just playing with this as the notification response came into my email…  I commented out lines 99 - 106 in NotificationService.cs and recompiled the DLL.  Seems to have done the trick on stopping the new ticket notice email.

Edit: Cleaned up junk from response in email....
Mar 5, 2009 at 4:08 PM

My last response was a bit premature, I suppose... I'm still getting the new ticket notices...  It's just that _ I _ did't get it because I was the one who created the ticket.  :)

These are the lines of code I commented out of notificationservice.cs (lines 99-106):



// foreach (var note in newNotes)

// {

// if (note.NotifyUserReason == "HelpDesk" && note.NextDeliveryAttemptDate != null)

// {

// SendTicketEventNotificationEmail(ctx, note, new List<TicketEventNotification>());

// }

// }


I re-published the app to a directory on my local machine, and then copied everything over to the web server (keeping only the modified AD web.config).  Not quite sure why I'm still getting the ticket creation notices.

Mar 5, 2009 at 4:35 PM
That section of code is simply resonsible for sending the new ticket notifications out immediatly. The idea there was that we didn't want new ticket notifications to wait around for the delay period... instead, we wanted help desk to get notified about the new ticket immediatly.

Without that block, the new ticket notifications are simply queued and would be sent out after the applicable delays and such elapse.

The part you need to kill is in Ticket.cs around line 92 and looks like this:

  if (AssignedTo == null && (this.TicketComments.Count < 2 || isGiveUp))
                string[] admins = SecurityManager.GetAdministrativeUsers().Select(a => a.Name).ToArray();
                foreach (string admin in admins)
                    if (!usersToAdd.ContainsKey(admin))
                        usersToAdd.Add(admin, "HelpDesk");

And... yes, there is a bug in this part of the code, and I didn't catch it until I went to find the block for this message. It is using the GetAdministrativeUsers() method instead of the GetHelpDeskUsers() method. I've fixed that and have checked it in, but if you are just gonna comment it out no need for you to get the new version.

Mar 5, 2009 at 4:44 PM
Thanks Stephen... I had just figured out that the regular delivery notification process is what was still causing the notice to go out... I was just going to modify the code to have the notice status set to Sent.  :)

I'll go ahead and download the latest code, and use your method to control the initial notices.  Less I'm in hacking away (which I freely admit I'm a hack at this point), the better.  But I'm having fun learning again!

Thanks for taking the time.
Sep 21, 2011 at 3:23 PM

Hope its ok I snag this thread, a bit bumping.

I did just that thing

            //only add help desk for brand new tickets (they should have exactly 1 comment when new)
            //  or tickets that have been given up on (was assigned but is not anymore).
            //if (AssignedTo == null && (this.TicketComments.Count < 2 || isGiveUp))
            //    string[] admins = SecurityManager.GetHelpDeskUsers().Select(a => a.Name).ToArray();
            //    foreach (string admin in admins)
            //    {
            //        if (!usersToAdd.ContainsKey(admin))
            //        {
            //            usersToAdd.Add(admin, "HelpDesk");
            //        }
            //    }

But I still get an email sendout when I add a new ticket. Have I done something wrong?


/Best regards Wiklander

Sep 21, 2011 at 10:47 PM

I can't say for sure Wiklander, there just isn't enough information. Commenting out that code, recompiling, and re-deploying it should remove new ticket notifications.  

For TD 2, I'm preparing a major update that will give the admin full control over how/if these notifications are sent and to who they are sent.  I'd not planned to do any more development against the TD 1 branch though.