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.
<CFIF flduser_id_assign_to NEQ Session.UserID>
<CF_CCToSQL Value="#flduser_id_assign_to#" Type="#ccsInteger#">
<CF_CCDLookUp Field="email" Table="employees" Where="emp_id=#CCToSQL#" Connection="IntranetDB"> <CFSET mai1_To=CCDLookUp> <CF_CCToSQL Value="#Session.UserID#" Type="#ccsInteger#"> <CF_CCDLookUp Field="email" Table="employees" Where="emp_id=#CCToSQL#" Connection="IntranetDB"> <CFSET mai1_From=CCDLookUp> <CF_CCGetParam strName="task_id" def=""> <CFMAIL TO="#mai1_To#" FROM="#mai1_From#" SUBJECT="New task for you" TYPE="HTML"> The following task was assigned to you:<br><br> Task ID:#CCGetParam# <br><br>#fldtask_desc# </CFMAIL> </CFIF>
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.cfm?task_id=9
Next: Test Email Delivery