The script below will append the text 'Assigned to User: {firstName lastName}' and 'Completed by User: {firstName lastName}' to the end of the task description in cases where the users Email address was changed on the __M_Users table as a result of User Mapping.
In cases where the firm's domain has changed, every user's email address will have changed. In which case the script below will add that information to all tasks, which would be redundant for some records. Therefore, you might want to adjust the WHERE clause accordingly.
- --Update Tasks to have the Assigned To/Completed By in their description.
- UPDATE __M_Tasks SET Final_Description = CONCAT(Final_Description, CHAR(10), CHAR(10), 'Assigned to User: ', u.Final_FirstName, ' ', u.Final_LastName) FROM __M_Tasks_AssignedTo_Users tau __M_Users u, __M_Tasks t WHERE 1=1 AND u.Original_Email != u.Final_Email
- AND t.Id = tau.Final_TaskEntry_Id
- AND u.Id = tau.Final_User_Id UPDATE __M_Tasks SET Final_Description = CONCAT(Final_Description, CHAR(10), CHAR(10), 'Completed by User: ', u.Final_FirstName, ' ', u.Final_LastName) FROM __M_Users u __M_Tasks t WHERE 1=1 AND u.Original_Email != u.Final_Email
- AND t.Final_Completed_By_Id = u.Id