+ Start a Discussion

Trigger to update Opportunity stage from Task subject

i'm looking to update custom picklists on opportunity when a sepcific user is sending an email with specific subject,
there are two user lookups on the opp, when the user in lookup A sends the email and the subject contains X, or user  B with subject Y, i'd like a picklist C or D to be updated with a value "in progress"

i found this but i cant modify to meet the above..

trigger TaskSubject on Task (after update, after insert) {
set<id> accountIdSet = new set<id>();
//capture all the subject names in a set
//set<string> subjectName = new set<string>{'financial review','legal precheck'};
map<id, list<opportunity>> opptyMap = new map<id, list<opportunity>>();
list<opportunity> updateOppList = new list<opportunity>();
//get those tasks where the tasks are related to opp, Capture the account IDs in a set.
for(task t: trigger.new){
            string tempId = string.valueOf(t.WhatId);
    }   }
//If we get the opportunities then change the stage.
if(Trigger.isUpdate && opptyMap.size()>0){
    for(task t: trigger.new){
 //Check if the subject of the task is one among the set
 //and also confirm that the subject has been changed.
        if(t.subject != trigger.oldMap.get(t.id).subject && opptyMap.containsKey(t.whatId)){
  //iterate thru the list of the opportunity associated with that account
  //and check which of the opportunity contains the task subject in the
   //opportunity name and update the stage to qualification
            for(opportunity oppty: opptyMap.get(t.whatId)){
                }            }        }        }        }
if(Trigger.isInsert && opptyMap.size()>0){
     for(task t: trigger.new){
                for(opportunity oppty: opptyMap.get(t.whatId)){
                   }              }            }         }        }
//update the oppties
    update updateOppList;
}     }

..please help me:)