• sakthidharan Ambayiram
  • NEWBIE
  • 70 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 10
    Replies
I am new to lightning . I am getting the below error

"This page has an error. You might just need to refresh it.
Error in $A.getCallback() [Component is not defined]
Callback failed: apex://getAccountList/ACTION$getAllAccounts
Failing descriptor: {c:AccList}"

My Code:
****************Apex class****************
public class getAccountList {
    @AuraEnabled
    public static List<Account> getAllAccounts(){
        return[select Id,Name,Type,Phone from Account ];
    }
     @AuraEnabled
    public static List<Account> getFilterAccounts(){
        return[select Id,Name,Type,Phone from Account where Type='Prospect'];
    }
}
************COMPONENT************************
<aura:component controller="getAccountList" >
    <aura:attribute name="AccList" type="List" />
    <aura:attribute name="PaginationList" type="Account[]" />
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="Pagesize" type="Integer" default="10" />
    <aura:attribute name="Totalsize" type="Integer" />
    <tr><ui:inputSelect aura:id="records" >
        <ui:inputSelectOption text="10" value="10"/>
        <ui:inputSelectOption text="20" value="20"/>
        <ui:inputSelectOption text="30" value="30"/>
    </ui:inputSelect></tr>
    <table>
        <thead>
            <th>Id</th>
            <th>Name</th>
            <th>Phone</th>
            <th>Type</th>
        </thead>
     <tbody>
            <aura:iteration items="{! v.AccList}" var="Acc" >
                <tr>
                    <td>{! Acc.Id}</td>
                    <td>{! Acc.Name}</td>
                    <td>{! Acc.Phone}</td>
                    <td>{! Acc.Type}</td>
                    <td><c:Menu testRecord="{! Acc.Id}"/></td>
                </tr>
            </aura:iteration>
        </tbody>
    </table>
</aura:component>
********************Controller*******************
({
    doInit : function(component, event, helper){
        helper.callServerMethod(component,"c.getAllAccounts","v.AccList");    
       
    }

})
*******************Helper*****************************
({
    callServerMethod : function(component,methodName,attributeName) {
    var Pagesize = component.get("v.Pagesize");
    var methodRef = component.get(methodName);
        methodRef.setCallback(this,function(response){
            if(response.getState()=="SUCCESS"){
                component.set(attributeName,response.getReturnValue());
            }else{
                alert("Problem in method call");
            }
            Component.set("v.Totalsize",component.get(methodName).length);
            var PaginationList = [];
            for(var i=0;i<Pagesize;i++)
            {
                PaginationList.push(response.getReturnValue()[i]);
            }
            component.set("v.PaginationList",PaginationList);
        });
        $A.enqueueAction(methodRef);
    }    
})
In setup quick find box update reminders under opportunity and i enabled the update reminders and below that i can see the reminders created for the users and activated for some of the users 
here my question is how to create a reminder for the users.
once i done with that it should come under the update reminder settings section in the page 
plz help me ASAP
Scenario: To count the the total cases in the account whenever creating a new case and up[date the case count field in account object through trigger and class
Issue: Case Count field is not updated in account record when the new case getting created 

trigger newCaseInsert on Case (after insert) {
    for(Case cs: trigger.new)
    getCaseCount.getupdatedCount(cs.Account.id);
    }

public class getCaseCount {
     public static Integer CountValue;
     public static Integer getupdatedCount(String AccountId){
         CountValue =[Select COUNT() from Case where Account.id=:AccountId];
         List<Account> record= [Select id,Name,Case_Count__c from Account where Account.id=:AccountId];
         for(Account acts: record){
           acts.Case_Count__c=CountValue;
         }
         update record;
         return CountValue ; 
    }  
}
Error:Apex trigger Test caused an unexpected exception, contact your administrator: Test: execution of AfterUpdate caused by: System.StringException: Invalid id: Dickenson Mobile Generators: Trigger.Test: line 8, column 1
Scenario: whenever the stage field changed to Close won in opportunities , a new object record (Litrack__c)should be created.
Code:
trigger Test on Opportunity (after update) {
    Map<Id,Litrack__c> LitInsert= new Map<Id,Litrack__c>();
    for(Opportunity opNew: Trigger.new){
        for(Opportunity opOld: Trigger.old){
            if(opNew.StageName!=opOld.StageName && opNew.StageName=='Closed Won'){
                Litrack__c Record = new Litrack__c();
                Record.Name=opNew.id;
                Record.Opportunity_Lookup__c=opNew.Name;
                LitInsert.put(Record.id,Record);
            }
        }
      
                insert LitInsert.values();
             
}
}
For example i want to count the records in opportunity for the conditions like type='New customer' and StageName='Prospecting' in a single query?
plz reply back with your answers, thanks in Advance
Hi all,

Error: This page has an error. You might just need to refresh it.
Error in $A.getCallback() [response.getReturnValue is not a function]
Callback failed: apex://getAccountList/ACTION$getFilterAccounts
Failing descriptor: {c:AccList}

**************component
<aura:component controller="getAccountList">
    <aura:attribute name="AccList" type="List" />
    <lightning:button label="Get All Filter Accounts" onclick="{! c.getFilterAccountss}" />
    <aura:iteration items="{! v.AccList}" var="Acc" >
        <tr>
            <td>{! Acc.Id}</td>
            <td>{! Acc.Name}</td>
            <td>{! Acc.Phone}</td>
            <td>{! Acc.Type}</td>
        </tr>
    </aura:iteration>
</aura:component>
********************apex class
public class getAccountList {
   
     @AuraEnabled
    public static List<Account> getFilterAccounts(){
        return[select Id,Name,Type,Phone from Account where Type='Prospect'];
    }

}
************************controller
({
    getFilterAccountss : function(component, event, helper) {
        var accRef = component.get("c.getFilterAccounts");
        accRef.setCallback(this,function (response){
           var response = response.getState(); 
            if(response=="SUCCESS"){
                //alert("Success");
                  component.set("v.AccList",response.getReturnValue());
            }else{alert("No Response")}
        });
        $A.enqueueAction(accRef);
    }
   
})

please help me to resolve this issue
Apex Class
/*
Having the Utilities of the Askiiris Integration
*/
public without Sharing class Integration_Util {
    Public Static FINAL String DML_ERROR='Error Occured While Saving Record To database';
    /*
Method to log the integration trace in notes
*/
    Public Static void InsertNote(id parentId,string body,string title,boolean isPrivate,boolean ExceptionOccured){
        note resp = new note();
        resp.parentId = parentId; 
        resp.body =body; 
        resp.title = title; 
        resp.isPrivate = isPrivate; 
        database.insert(resp,false); 
    }
     /*
Method to send the Exception Email to CMSO-PS
*/
    public static void sendExceptionEmail(String[] emailId,String subject,String emailBody){
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        semail.setToAddresses(emailId); 
        semail.setSubject(subject); 
        semail.setHtmlBody(emailBody); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail}); 
    } 
    /*
Method to get the Integration Credentials
*/
    Public Static CredentialsWrapper getCredetials( String credentialDevName){
        Integration_Credentials_Mapping__mdt mdt=[select id,Production_End_point_URI__c,Sanbox_End_point_URI__c,
                                                  Sandbox_password__c,Sandbox_user_name__c,Production_password__c,
                                                  Production_user_name__c,security_hns__c,Suffix_URL_1__c,Suffix_URL_2__c,
                                                  Sandbox_Auth_URI__c,Production_Auth_URI__c
                                                  From Integration_Credentials_Mapping__mdt 
                                                  where DeveloperName=:credentialDevName LIMIT 100];
        
        boolean isSandbox=[SELECT issandbox from organization LIMIT 1].isSandbox;
        CredentialsWrapper credwrap=new CredentialsWrapper();
        if(isSandbox){
            credwrap.enpointUrl=mdt.Sanbox_End_point_URI__c;
            credwrap.username =mdt.Sandbox_user_name__c;
            credwrap.password =mdt.Sandbox_password__c;
            credwrap.authTokenUrl =mdt.Sandbox_Auth_URI__c; 
        }else{
            credwrap.enpointUrl=mdt.Production_End_point_URI__c;
            credwrap.username=mdt.Production_user_name__c;
            credwrap.password=mdt.Production_password__c;
            credwrap.authTokenUrl =mdt.Production_Auth_URI__c; 
        }
        credwrap.hnsUrl=mdt.security_hns__c;
        credwrap.isSandbox=isSandbox;
        credwrap.suffixUrl1=mdt.Suffix_URL_1__c;
        credwrap.suffixUrl2=mdt.Suffix_URL_2__c;
        
        return credwrap;
    } 
    /*
Wrapper class used wrap the Integration Credentials
*/
    Public without sharing class CredentialsWrapper{
        Public String username;
        Public String password;
        Public String enpointUrl;
        Public String hnsUrl;
        public Boolean isSandbox;
        Public String suffixUrl1;
        public String suffixUrl2;
        Public String authTokenUrl;
        
    }
    
}

My Test Class

@isTest
public class Integration_Util_UT {

    private static testmethod void InsertNote() {
    Integration_Util.InsertNote('00300000003T2PGAA0','hello','hello',True,True);
     }                    
                    
    private static testmethod void sendExceptionEmail() {
        Integration_Util.sendExceptionEmail('fdgd@df.com','hello','hello');
       }                
                    
    private static testmethod void getCredetials() {
        Integration_Util.getCredetials('hello');
        }                    
}                

My error : "Method does not exist or incorrect signature: void sendExceptionEmail(String, String, String) from the type Integration_Util"
Also the current code coverage is 31%, please hep me to get code coverage 
Thanks in advance
Hi all ,
getting the below eeror while excuting batch
Line: 2, Column: 10
Method does not exist or incorrect signature: void executeBatch(CustomerProcessingBatch) from the type Database

Executing the below code in Anonymous window 

CustomerProcessingBatch objectClass=new CustomerProcessingBatch();
Database.executeBatch(objectClass);

ApexClass:
global class CustomerProcessingBatch implements Database.Batchable<sObject>
{
    global String[] email=new string[] {'a.sakthidhn@gmail.com'};
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
       return Database.getQueryLocator('select id,name,Customer_Status__c,Customer_Description__c from Apex_Customer__c where Active__c=true');
    }
    //execute
    global void execute(Database.BatchableContext BC,List <sObject> scope)
    {
        List<Apex_Customer__c> CustomerList=new List<Apex_Customer__c>();
        for(sObject objscope: scope)
        {
            Apex_Customer__c newobjscope=(Apex_Customer__c)objscope;
            newobjscope.Customer_Description__c='Records updated via Batch Job';
            newobjscope.Customer_Status__c='Paid';
            CustomerList.Add(newobjscope);
            system.debug('Records Updated' +CustomerList);
        }
        if(CustomerList!=null && CustomerList.size()>0)
        {
            Database.update(CustomerList);
            system.debug('Records Updated'+CustomerList);
        }
     }
    global void finish(Database.BatchableContext BC)
    {
        Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
        AsyncApexjob a= [select a.Totaljobitems, a.Status,a.NumberOfErrors,a.JobType,a.JobItemsProcessed,a.ExtendedStatus,a.CreatedById,a.CompletedDate from AsyncApexJob a where id= :BC.getJobId()];
        system.debug('JobId'+BC.getJobId());
        mail.SetToAddresses(email);        
        mail.SetReplyTo('a.sakthidhn@gmail.com');
        mail.SetSenderDisplayName('Apex Batch Processing Module');
        mail.setSubject('Batch Status' +a.Status);
        mail.setPlainTextBody('The Batch Apex Job Processed'+a.TotalJobItems+'Batches with'+a.NumberOfErrors+'Failures'+'Job Proceesed are'+a.JobItemsProcessed);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
     }
}
//Requirement : we need to create a Contact record every time when you create a new Account
*************
trigger AccountTrigger on Account (after insert) {
List<Contact> ContactList=new List<Contact>();
for(Account a: Trigger.new)
    {
    Contact C=new Contact();
    C.LastName=a.Name;
    ContactList.Add(C);
    }
    insert ContactList;
}
***************************
//Facing the below error when i try to create a new Account
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger AccountTrigger caused an unexpected exception, contact your administrator: 
AccountTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. 
First exception on row 0; first error: 
FIELD_CUSTOM_VALIDATION_EXCEPTION, u cant insert anew record without email: []: Trigger.AccountTrigger: line 9, column 1
Hi all ,
getting the below eeror while excuting batch
Line: 2, Column: 10
Method does not exist or incorrect signature: void executeBatch(CustomerProcessingBatch) from the type Database

Executing the below code in Anonymous window 

CustomerProcessingBatch objectClass=new CustomerProcessingBatch();
Database.executeBatch(objectClass);

ApexClass:
global class CustomerProcessingBatch implements Database.Batchable<sObject>
{
    global String[] email=new string[] {'a.sakthidhn@gmail.com'};
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
       return Database.getQueryLocator('select id,name,Customer_Status__c,Customer_Description__c from Apex_Customer__c where Active__c=true');
    }
    //execute
    global void execute(Database.BatchableContext BC,List <sObject> scope)
    {
        List<Apex_Customer__c> CustomerList=new List<Apex_Customer__c>();
        for(sObject objscope: scope)
        {
            Apex_Customer__c newobjscope=(Apex_Customer__c)objscope;
            newobjscope.Customer_Description__c='Records updated via Batch Job';
            newobjscope.Customer_Status__c='Paid';
            CustomerList.Add(newobjscope);
            system.debug('Records Updated' +CustomerList);
        }
        if(CustomerList!=null && CustomerList.size()>0)
        {
            Database.update(CustomerList);
            system.debug('Records Updated'+CustomerList);
        }
     }
    global void finish(Database.BatchableContext BC)
    {
        Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
        AsyncApexjob a= [select a.Totaljobitems, a.Status,a.NumberOfErrors,a.JobType,a.JobItemsProcessed,a.ExtendedStatus,a.CreatedById,a.CompletedDate from AsyncApexJob a where id= :BC.getJobId()];
        system.debug('JobId'+BC.getJobId());
        mail.SetToAddresses(email);        
        mail.SetReplyTo('a.sakthidhn@gmail.com');
        mail.SetSenderDisplayName('Apex Batch Processing Module');
        mail.setSubject('Batch Status' +a.Status);
        mail.setPlainTextBody('The Batch Apex Job Processed'+a.TotalJobItems+'Batches with'+a.NumberOfErrors+'Failures'+'Job Proceesed are'+a.JobItemsProcessed);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
     }
}
I am new to lightning . I am getting the below error

"This page has an error. You might just need to refresh it.
Error in $A.getCallback() [Component is not defined]
Callback failed: apex://getAccountList/ACTION$getAllAccounts
Failing descriptor: {c:AccList}"

My Code:
****************Apex class****************
public class getAccountList {
    @AuraEnabled
    public static List<Account> getAllAccounts(){
        return[select Id,Name,Type,Phone from Account ];
    }
     @AuraEnabled
    public static List<Account> getFilterAccounts(){
        return[select Id,Name,Type,Phone from Account where Type='Prospect'];
    }
}
************COMPONENT************************
<aura:component controller="getAccountList" >
    <aura:attribute name="AccList" type="List" />
    <aura:attribute name="PaginationList" type="Account[]" />
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="Pagesize" type="Integer" default="10" />
    <aura:attribute name="Totalsize" type="Integer" />
    <tr><ui:inputSelect aura:id="records" >
        <ui:inputSelectOption text="10" value="10"/>
        <ui:inputSelectOption text="20" value="20"/>
        <ui:inputSelectOption text="30" value="30"/>
    </ui:inputSelect></tr>
    <table>
        <thead>
            <th>Id</th>
            <th>Name</th>
            <th>Phone</th>
            <th>Type</th>
        </thead>
     <tbody>
            <aura:iteration items="{! v.AccList}" var="Acc" >
                <tr>
                    <td>{! Acc.Id}</td>
                    <td>{! Acc.Name}</td>
                    <td>{! Acc.Phone}</td>
                    <td>{! Acc.Type}</td>
                    <td><c:Menu testRecord="{! Acc.Id}"/></td>
                </tr>
            </aura:iteration>
        </tbody>
    </table>
</aura:component>
********************Controller*******************
({
    doInit : function(component, event, helper){
        helper.callServerMethod(component,"c.getAllAccounts","v.AccList");    
       
    }

})
*******************Helper*****************************
({
    callServerMethod : function(component,methodName,attributeName) {
    var Pagesize = component.get("v.Pagesize");
    var methodRef = component.get(methodName);
        methodRef.setCallback(this,function(response){
            if(response.getState()=="SUCCESS"){
                component.set(attributeName,response.getReturnValue());
            }else{
                alert("Problem in method call");
            }
            Component.set("v.Totalsize",component.get(methodName).length);
            var PaginationList = [];
            for(var i=0;i<Pagesize;i++)
            {
                PaginationList.push(response.getReturnValue()[i]);
            }
            component.set("v.PaginationList",PaginationList);
        });
        $A.enqueueAction(methodRef);
    }    
})
Scenario: To count the the total cases in the account whenever creating a new case and up[date the case count field in account object through trigger and class
Issue: Case Count field is not updated in account record when the new case getting created 

trigger newCaseInsert on Case (after insert) {
    for(Case cs: trigger.new)
    getCaseCount.getupdatedCount(cs.Account.id);
    }

public class getCaseCount {
     public static Integer CountValue;
     public static Integer getupdatedCount(String AccountId){
         CountValue =[Select COUNT() from Case where Account.id=:AccountId];
         List<Account> record= [Select id,Name,Case_Count__c from Account where Account.id=:AccountId];
         for(Account acts: record){
           acts.Case_Count__c=CountValue;
         }
         update record;
         return CountValue ; 
    }  
}
Error:Apex trigger Test caused an unexpected exception, contact your administrator: Test: execution of AfterUpdate caused by: System.StringException: Invalid id: Dickenson Mobile Generators: Trigger.Test: line 8, column 1
Scenario: whenever the stage field changed to Close won in opportunities , a new object record (Litrack__c)should be created.
Code:
trigger Test on Opportunity (after update) {
    Map<Id,Litrack__c> LitInsert= new Map<Id,Litrack__c>();
    for(Opportunity opNew: Trigger.new){
        for(Opportunity opOld: Trigger.old){
            if(opNew.StageName!=opOld.StageName && opNew.StageName=='Closed Won'){
                Litrack__c Record = new Litrack__c();
                Record.Name=opNew.id;
                Record.Opportunity_Lookup__c=opNew.Name;
                LitInsert.put(Record.id,Record);
            }
        }
      
                insert LitInsert.values();
             
}
}
For example i want to count the records in opportunity for the conditions like type='New customer' and StageName='Prospecting' in a single query?
plz reply back with your answers, thanks in Advance
Hi all,

Error: This page has an error. You might just need to refresh it.
Error in $A.getCallback() [response.getReturnValue is not a function]
Callback failed: apex://getAccountList/ACTION$getFilterAccounts
Failing descriptor: {c:AccList}

**************component
<aura:component controller="getAccountList">
    <aura:attribute name="AccList" type="List" />
    <lightning:button label="Get All Filter Accounts" onclick="{! c.getFilterAccountss}" />
    <aura:iteration items="{! v.AccList}" var="Acc" >
        <tr>
            <td>{! Acc.Id}</td>
            <td>{! Acc.Name}</td>
            <td>{! Acc.Phone}</td>
            <td>{! Acc.Type}</td>
        </tr>
    </aura:iteration>
</aura:component>
********************apex class
public class getAccountList {
   
     @AuraEnabled
    public static List<Account> getFilterAccounts(){
        return[select Id,Name,Type,Phone from Account where Type='Prospect'];
    }

}
************************controller
({
    getFilterAccountss : function(component, event, helper) {
        var accRef = component.get("c.getFilterAccounts");
        accRef.setCallback(this,function (response){
           var response = response.getState(); 
            if(response=="SUCCESS"){
                //alert("Success");
                  component.set("v.AccList",response.getReturnValue());
            }else{alert("No Response")}
        });
        $A.enqueueAction(accRef);
    }
   
})

please help me to resolve this issue
Apex Class
/*
Having the Utilities of the Askiiris Integration
*/
public without Sharing class Integration_Util {
    Public Static FINAL String DML_ERROR='Error Occured While Saving Record To database';
    /*
Method to log the integration trace in notes
*/
    Public Static void InsertNote(id parentId,string body,string title,boolean isPrivate,boolean ExceptionOccured){
        note resp = new note();
        resp.parentId = parentId; 
        resp.body =body; 
        resp.title = title; 
        resp.isPrivate = isPrivate; 
        database.insert(resp,false); 
    }
     /*
Method to send the Exception Email to CMSO-PS
*/
    public static void sendExceptionEmail(String[] emailId,String subject,String emailBody){
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        semail.setToAddresses(emailId); 
        semail.setSubject(subject); 
        semail.setHtmlBody(emailBody); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail}); 
    } 
    /*
Method to get the Integration Credentials
*/
    Public Static CredentialsWrapper getCredetials( String credentialDevName){
        Integration_Credentials_Mapping__mdt mdt=[select id,Production_End_point_URI__c,Sanbox_End_point_URI__c,
                                                  Sandbox_password__c,Sandbox_user_name__c,Production_password__c,
                                                  Production_user_name__c,security_hns__c,Suffix_URL_1__c,Suffix_URL_2__c,
                                                  Sandbox_Auth_URI__c,Production_Auth_URI__c
                                                  From Integration_Credentials_Mapping__mdt 
                                                  where DeveloperName=:credentialDevName LIMIT 100];
        
        boolean isSandbox=[SELECT issandbox from organization LIMIT 1].isSandbox;
        CredentialsWrapper credwrap=new CredentialsWrapper();
        if(isSandbox){
            credwrap.enpointUrl=mdt.Sanbox_End_point_URI__c;
            credwrap.username =mdt.Sandbox_user_name__c;
            credwrap.password =mdt.Sandbox_password__c;
            credwrap.authTokenUrl =mdt.Sandbox_Auth_URI__c; 
        }else{
            credwrap.enpointUrl=mdt.Production_End_point_URI__c;
            credwrap.username=mdt.Production_user_name__c;
            credwrap.password=mdt.Production_password__c;
            credwrap.authTokenUrl =mdt.Production_Auth_URI__c; 
        }
        credwrap.hnsUrl=mdt.security_hns__c;
        credwrap.isSandbox=isSandbox;
        credwrap.suffixUrl1=mdt.Suffix_URL_1__c;
        credwrap.suffixUrl2=mdt.Suffix_URL_2__c;
        
        return credwrap;
    } 
    /*
Wrapper class used wrap the Integration Credentials
*/
    Public without sharing class CredentialsWrapper{
        Public String username;
        Public String password;
        Public String enpointUrl;
        Public String hnsUrl;
        public Boolean isSandbox;
        Public String suffixUrl1;
        public String suffixUrl2;
        Public String authTokenUrl;
        
    }
    
}

My Test Class

@isTest
public class Integration_Util_UT {

    private static testmethod void InsertNote() {
    Integration_Util.InsertNote('00300000003T2PGAA0','hello','hello',True,True);
     }                    
                    
    private static testmethod void sendExceptionEmail() {
        Integration_Util.sendExceptionEmail('fdgd@df.com','hello','hello');
       }                
                    
    private static testmethod void getCredetials() {
        Integration_Util.getCredetials('hello');
        }                    
}                

My error : "Method does not exist or incorrect signature: void sendExceptionEmail(String, String, String) from the type Integration_Util"
Also the current code coverage is 31%, please hep me to get code coverage 
Thanks in advance
Hi all ,
getting the below eeror while excuting batch
Line: 2, Column: 10
Method does not exist or incorrect signature: void executeBatch(CustomerProcessingBatch) from the type Database

Executing the below code in Anonymous window 

CustomerProcessingBatch objectClass=new CustomerProcessingBatch();
Database.executeBatch(objectClass);

ApexClass:
global class CustomerProcessingBatch implements Database.Batchable<sObject>
{
    global String[] email=new string[] {'a.sakthidhn@gmail.com'};
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
       return Database.getQueryLocator('select id,name,Customer_Status__c,Customer_Description__c from Apex_Customer__c where Active__c=true');
    }
    //execute
    global void execute(Database.BatchableContext BC,List <sObject> scope)
    {
        List<Apex_Customer__c> CustomerList=new List<Apex_Customer__c>();
        for(sObject objscope: scope)
        {
            Apex_Customer__c newobjscope=(Apex_Customer__c)objscope;
            newobjscope.Customer_Description__c='Records updated via Batch Job';
            newobjscope.Customer_Status__c='Paid';
            CustomerList.Add(newobjscope);
            system.debug('Records Updated' +CustomerList);
        }
        if(CustomerList!=null && CustomerList.size()>0)
        {
            Database.update(CustomerList);
            system.debug('Records Updated'+CustomerList);
        }
     }
    global void finish(Database.BatchableContext BC)
    {
        Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
        AsyncApexjob a= [select a.Totaljobitems, a.Status,a.NumberOfErrors,a.JobType,a.JobItemsProcessed,a.ExtendedStatus,a.CreatedById,a.CompletedDate from AsyncApexJob a where id= :BC.getJobId()];
        system.debug('JobId'+BC.getJobId());
        mail.SetToAddresses(email);        
        mail.SetReplyTo('a.sakthidhn@gmail.com');
        mail.SetSenderDisplayName('Apex Batch Processing Module');
        mail.setSubject('Batch Status' +a.Status);
        mail.setPlainTextBody('The Batch Apex Job Processed'+a.TotalJobItems+'Batches with'+a.NumberOfErrors+'Failures'+'Job Proceesed are'+a.JobItemsProcessed);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
     }
}
//Requirement : we need to create a Contact record every time when you create a new Account
*************
trigger AccountTrigger on Account (after insert) {
List<Contact> ContactList=new List<Contact>();
for(Account a: Trigger.new)
    {
    Contact C=new Contact();
    C.LastName=a.Name;
    ContactList.Add(C);
    }
    insert ContactList;
}
***************************
//Facing the below error when i try to create a new Account
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger AccountTrigger caused an unexpected exception, contact your administrator: 
AccountTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. 
First exception on row 0; first error: 
FIELD_CUSTOM_VALIDATION_EXCEPTION, u cant insert anew record without email: []: Trigger.AccountTrigger: line 9, column 1