As you may know, when the consultant "Accepts" the task it sends an automated email to the requester of the task. I have a script running that searches that sent email for the particular subject line, in this case "Task Accepted" and when found creates a new appointment in their calendar. The script searches the email for the start and end dates of the task and adjusts the appointment accordingly. It also searches for other variables that make up the subject of the appointment (Project No. - Task No. - Task Description) and adds "- WORKING" to the end of the subject. SO after the consultant accepts the task they have an appointment in their calendar with a subject and the dates set... PERFECT!
Now what I am struggling with is changing the backend of the subject line "- WORKING" to read "- AWAITING QC" after checking their task completed. Again, as you may know, when you "Mark Complete" a task, it sends an automated email to the requester of the task. I was thinking of using the same concept as before, searching a sent email that has a particular line of text (in this case "Task Completed") to get the process started.

On this sent email I need it to look through all of the consultant's appointment, FIND the correct one, and then change the subject line. I cannot have the script just search for the word "working" as they may be working on multiple projects at a time. I need a search that uses the data found in the sent email. Below is what you find in the automated email when the consultant marks the task completed:

-----Original Task-----
Subject: 123456
(unique Project no.) – Task 78 (unique Task no.) – Task Description
Priority: Normal

Start date: Thu 9/29/2016
Due date: Fri 9/30/2016

Status: Completed
% Complete: 100%
Date completed: Fri 9/30/2016
Actual work: 2 hours

Requested by: (Requester's name)


I obviously should use the Subject line as my search, but I am not sure what to do (of course haha)... It would be a script that would start on a "if sent email reads 'Task Completed'", then searches through the appointments using the content of that sent email's body, and next once it finds the appointment opens it and changes the "- WORKING" of the subject line to read "- AWAITING QC" Finish it off with a save and close.

Any and all help is greatly appreciated.