+ Start a Discussion
sfdc dev 2264sfdc dev 2264 

Error: Compile Error: unexpected syntax: 'mismatched input ',' expecting MAPPED_TO' at line 18 column 11

Hi,

I am getting the following error on my apex class

Error: Compile Error: unexpected syntax: 'mismatched input ',' expecting MAPPED_TO' at line 18 column 11


Help me how to fix it

Thanks in Advance
MY APEX CLASS :


public class overlapDateHandler{

    public void overlapDateMethod(list<contract> contractList){
    
        set<Id> accountIdSet = new set<Id>();
        list<Account> accList = new List<Account>();
        map<integer, integer> dateMap = new map<integer, integer>{
        1 => 31, 
        3 => 31, 
        4 =>30, 
        5 =>31, 
        6 => 30, 
        7 => 31, 
        8 => 31, 
        9 =>30, 
        10 =>31, 
        11 =>30, 
        12, 31, };
        map<id, list<Contract>> idVsContractmap = new map<id, list<contract>>();
        list<Contract> updateContractList = new list<Contract>();
        for(Contract conObj : contractList){
            
            if(conObj.AccountId  != null){
                
                accountIdSet.add(conObj.AccountId);
            }
        }
        accList = [Select Id, (Select startdate__c, enddate__c, AccountId From Contracts) From Account Where Id IN :accountIdSet]
        for(Account accObj : accList){
            
            idVsContractmap.put(accObj.id, accObj.Contracts);
        }
        for(Contract conObj : contractList){
            
            if(conObj.AccountId != null){
            
                if(idVsContractmap.containsKey(conObj.AccountId)){
                    
                    for(Contract contractObj : idVsContractmap.get(conObj.AccountId)){
                        
                        if(contractObj.enddate__c.month() == conObj.startdate__c.month()){
                            
                            if(contractObj.enddate__c.month() - 1 == 2){
                            
                                if(MOD( contractObj.enddate__c.year()) + 1, 4) = 0){
                                    
                                    string newDate = 29 +'//'+contractObj.enddate__c.month() - 1+'//'+contractObj.enddate__c.year();
                                    contractObj.enddate__c =  date.parse(newDate);
                                }
                                else{
                                    
                                    string newDate = 28 +'//'+contractObj.enddate__c.month() - 1+'//'+contractObj.enddate__c.year();
                                    contractObj.enddate__c =  date.parse(newDate);
                                }
                            }
                            else if(contractObj.enddate__c.month() - 1 == 0){
                                
                                string newDate = 31 +'//'+12+'//'+contractObj.enddate__c.year() -1;
                                contractObj.enddate__c =  date.parse(newDate);
                            }
                            else{
                                
                                string newDate = 31 +'//'+dateMap.get(contractObj.enddate__c.month() - 1)+'//'+contractObj.enddate__c.year() -1;
                                contractObj.enddate__c =  date.parse(newDate);
                            }
                        }
                        updateContractList.add(contractObj);
                    }
                }
            }
        }
        update updateContractList;
    }
}

 
Best Answer chosen by sfdc dev 2264
Ahmad J. KoubeissyAhmad J. Koubeissy
correct the highlighted line.  
User-added image

replace it with 12=>31

Kindly mark as best answer if this is a solution

All Answers

Ahmad J. KoubeissyAhmad J. Koubeissy
correct the highlighted line.  
User-added image

replace it with 12=>31

Kindly mark as best answer if this is a solution
This was selected as the best answer
sfdc dev 2264sfdc dev 2264
I have a controller for which i have written a test class which covers only 50%, I am not able to cover the following lines for which i need help on it

//
   if(firstcontract.Contract_Start_Date__c<contractObj.Contract_Start_Date__c && firstcontract.Contract_End_Date__c<contractObj.Contract_End_Date__c ){
                          if(firstcontract.Contract_End_Date__c>=contractObj.Contract_Start_Date__c){
                          firstcontract.Contract_End_Date__c=contractObj.Contract_Start_Date__c.addDays(-1);
                          update firstcontract;//put the list and update
                          }                       
                        }  
                        else{
                        system.debug('elsesection');
                        if(contractObj.Contract_End_Date__c>=firstcontract.Contract_Start_Date__c){
                          contractObj.Contract_End_Date__c=firstcontract.Contract_Start_Date__c.addDays(-1);
                          update contractObj;// put the list and update
                          }    
                          
                          
                          //
                          
                            if(idVsContractmap.containsKey(controbj.Account__r.Id)) {
                List<Contract__c> contrAccList = idVsContractmap.get(controbj.Account__r.Id);
                contrAccList.add(controbj);
                idVsContractmap.put(controbj.Account__c, contrAccList);
            } else {
                idVsContractmap.put(controbj.Account__c, new List<Contract__c> { controbj });
            }   
            //

Kindly help me pls

Thanks in advance