CodeCharge StudioYou previously added the necessary code that sends email notification to the assignee upon recording a new task in the system. We shall now implement similar functionality in After Update Event to notify the assignee when an existing task is updated and reassigned to someone.
Dim Mailer
If CCGetUserID() <> tasks.user_id_assign_to.Value Then
Set Mailer = Server.CreateObject("Persits.MailSender")
Mailer.From = CCDLookUp("email", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)
Mailer.FromName = CCDLookUp("emp_name", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)
Mailer.AddAddress CCDLookUp("email", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger), DBIntranetDB)
Mailer.Host = "mysmtphost.com"
Mailer.IsHTML = True
Mailer.Subject = "A task was assigned to you"
Mailer.Body = "The following task was assigned to you:<br><br>" &_
"Task ID: " & CCGetParam("task_id", Empty)& _
"<br><br>" & tasks.task_desc.Text
Mailer.Send
set Mailer = Nothing
End if
The main differences between the above code and that which was used in the After Insert event are as follows:
http://localhost/TaskManager/tasks_maint.asp?task_id=9
Next: Test Email Delivery