• Rahul Maila 5
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
public class CaseAutoNumberHandler {
  
    public static void updateCounterSurvey(List<Case> cases){
             Integer maxLead_SSR;
             List<case> cases_SSR = [SELECT Id, CaseNumber, SSR_AutoNumber__c FROM Case Where and CreatedDate = this_year  order by createdDate desc limit 1];
         if(cases_SSR !=null && cases_SSR.size() == 0){
            system.debug('X - SelfService Size ' + cases_SSR.size() );
            maxLead_SSR = 0;
        }else{
            maxLead_SSR = Integer.valueOf(cases_SSR[0].SSR_AutoNumber__c);         
        }
        for(Case caseList:cases){
      
                if(caseList.RecordTypeId =='012200000002Ny1' && caseList.Region__c == 'UK & IReland'){
                caseList.SSR_AutoNumber__c = ++maxlead_SSR;
            } 
        }
    }
}
This code is to generate autonumber for a specific recordtype. 
Two things:
1. In the SOQL, in the where clause when I put "CreatedDate != this_year" and go back to create a case to see if AutoNumber is being genetrated fine I get 'System.Query.Exception: Non-selective Quesry against large Object Type'. 
2. Then when I come back and change the where clause to "CreatedDate = this_year", case gets created but AutoNumber stays at the same value like it was for pervious case. Dont understand what I am doing wrong. Any pointers would be much Appricriated!
Linked each rating to this site i have created. Everything works fine, but my Manager wants this :
When Customer clicks say Rating 8 in his email (this redirects to survey page) that value 8 has to reflect in the Site Rating (there are Radio buttons 0 to through 10 in the site).
Any ideas how I can make the clicked rating in the Email reflect on Site Rating? Please Help 
public class CaseAutoNumberHandler {
  
    public static void updateCounterSurvey(List<Case> cases){
             Integer maxLead_SSR;
             List<case> cases_SSR = [SELECT Id, CaseNumber, SSR_AutoNumber__c FROM Case Where and CreatedDate = this_year  order by createdDate desc limit 1];
         if(cases_SSR !=null && cases_SSR.size() == 0){
            system.debug('X - SelfService Size ' + cases_SSR.size() );
            maxLead_SSR = 0;
        }else{
            maxLead_SSR = Integer.valueOf(cases_SSR[0].SSR_AutoNumber__c);         
        }
        for(Case caseList:cases){
      
                if(caseList.RecordTypeId =='012200000002Ny1' && caseList.Region__c == 'UK & IReland'){
                caseList.SSR_AutoNumber__c = ++maxlead_SSR;
            } 
        }
    }
}
This code is to generate autonumber for a specific recordtype. 
Two things:
1. In the SOQL, in the where clause when I put "CreatedDate != this_year" and go back to create a case to see if AutoNumber is being genetrated fine I get 'System.Query.Exception: Non-selective Quesry against large Object Type'. 
2. Then when I come back and change the where clause to "CreatedDate = this_year", case gets created but AutoNumber stays at the same value like it was for pervious case. Dont understand what I am doing wrong. Any pointers would be much Appricriated!