• SFDev@321
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies

I have a custom obejct Sales_c in this i have 2 feilds:- 


1> competitor1_c :- Picklist
2> competitor2_c :- Picklist

 

Now, i have created another 2 look-up feilds :-

 

3> Comp1_c : Lookup feild
4> Comp2_c : Lookup feild


Now, i want to capture all picklist feilds(competitor1_c, competitor2_c) values in to look-up feilds (Comp1_c, Comp2_c).

REQUIREMENT :- Need to be able to delete Opportunities via data loader. 
i.e when i'm trying to delete some opportunites through DATA LOADER i'm getting the below ERROR :-


Getting the following message: 
tgrOpportunityBefore: execution of BeforeDelete 
caused by: System.NullPointerException: Attempt to de-reference a null object 
Trigger.tgrOpportunityBefore: line 379, column 1 

 

 

 

TRIGGER :-

 

 // --- This is used since most of the triggers are for Insert and Update on Opportunity.
    if(trigger.isInsert || trigger.isUpdate) {  
      //#101OICD - Variable Declaration -- Start    
      StaticVariables.setAccountDontRun(true); // stop account trigger from running
      List<Id> accIds = new List<Id>();
      Set<id> accidset = new set<id>();
      //#101OICD - Variable Declaration -- End
      
   
 
      //#101OICD -- Loop Through Opp records  and assign values -- Start
      for(Opportunity o:Trigger.new) {
        
        system.debug('Originator EIN ' + o.Originator_EIN__c);
        allCampaignIds.add(o.CampaignId);//CR2180        
        //if(o.Opportunity_Owner_EIN__c == '802558891') o.ABR_Count__c =1;  
        
     
        
        if(o.CloseDate ==null)o.CloseDate = (Date.today()+ 365);
        
        if(o.AccountId != null && o.Auto_Assign_Owner__c)accIds.add(o.accountId);
        
        if(o.OwnerId != null)o.owner__c = o.OwnerId;
        
        //add flag for org to org
        if (
        (o.Routing_Product__c == 'Engage IT' || o.Product_Family__c == 'ENGAGE IT') 
        && o.CreatedDate >= (date.newinstance(2011, 11, 19))  
        //    || ((trigger.newmap.get(o.id).Routing_Product__c != trigger.oldmap.get(o.id).Routing_Product__c)
        //    || (trigger.newmap.get(o.id).Product_Family__c != trigger.oldmap.get(o.id).Product_Family__c ))
        ){
            o.s2s_Link__c = 'BTB to Engage IT';  
        }
        

    //#101OICD -- Part of 101OICD Trigger to Modify Opportunit Owner By Account -- End
     
     //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- Start
        //Added by GS to update account last call date.
        //Update the account last call date field for these accounts      
        list<account> updateCallDate = new list<account>();          
        updateAccountLastContacted updateAccountCallDate = new updateAccountLastContacted();                     
        //updateCallDate = updateAccountCallDate.updateAccount(accidset);
        String objName='Opportunities';
        updateCallDate = updateAccountCallDate.updateAccount(accidset, objName);           
        update updateCallDate;               
    //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- End
    }
     
    //Set RAG Status to None if Leasing History has 0 records -- Start
   LINE 379 :- for(Opportunity o : trigger.new){
    Integer i = [SELECT count() FROM Leasing_History__c WHERE Opportunity__c =: o.Id LIMIT 1];
    if(i < 1){
      o.Finance_Available__c = 'None';
     }
    }    
    //Set RAG Status to None if Leasing History has 0 records -- End   
}