trigger Opportunity_Create_Task on Opportunity (before insert, before Update) {
        Set < Id > opIds = new Set < Id > ();
        List < Task > taskList = new List < Task > ();
        List < Opportunity > Opps = Trigger.new;
       	List<Opportunity> taskOps = [Select Id,Description from Opportunity where Id in :opIds];
        //Insert Opertaion
        if(Trigger.isInsert){
           for (Opportunity Opp: Opps) {
                Task t = new Task();
                t.WhatId = opp.Id;
                t.Subject = 'QMI Task';
                taskList.add(t);
        	}
        }
        //Update Operation
        if(Trigger.isUpdate){
            Map<Id,Opportunity> oldOppMap = Trigger.oldmap;
             for (Opportunity Opp: Opps) {
                 //Check If description got changed
                 if(Opp.description != oldOppMap.get(opp.Id).description){
                    Task t = new Task();
                    t.WhatId = opp.Id;
                    t.Subject = 'QMI Task';
                    taskList.add(t);
                 }
               
        	}
        }
        
        insert taskList;
    }