• Hariom kankerwal 7
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi All
I keep getting the following compile error: Class Update_Currency must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)
and global methods do not support parameter type of List<Opportunity>

FYI, here is my class code
global class Update_Currency implements Database.Batchable<Sobject>{
        global String apiKey;
    global Update_Currency(string apiKey){
        this.apiKey=apiKey;
    }   
      global Database.QueryLocator start(Database.BatchableContext bc){
       String query = 'select Id, Amount, INRValue__c from Opportunity';
       return Database.getQueryLocator(query);
      }
        global void execute(Database.BatchableContext bc, List<Opportunity> optyList){
        Http p = new Http();
        HttpREquest request = new HttpRequest();
        string endPoint = 'http://api.currencylayer.com/live';
        endPoint=endpoint+'access_key='+apiKey;
        endPoint=endPoint+'&currencies=INR&source=USD&format=1';
        request.setEndpoint(endpoint);
        request.setMethod('GET');
        HttpREsponse responce = p.send(request);
        String jsonString= response.getBody();
        System.JSONParser jp=JSON.createParser(jsonString);
        Decimal inrValue;
        while(jp.getText()!=null){
            if(jp.getText()=='USDINR'){
                jp.nextToken();
                inrValue=(Decimal)jp.getDecimalValue();
            }
        }
        for(Opporttunity op:optyList){
            op.INRValue__c = 'Rs'+(op.amount*inrValue);
        }
            update optyList;}
    global void finish(Database.BatchableContext bc){
        AsyncApexJob job =[select id,Status from AsyncApexjJob where Id =:bc.getJobId()];
        Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
        string[] toadd=new string []{'hariom.sfdc@gmail.com'};
        msg.setToAddresses(toAdd);
        msg.setSubject('Intergration First Programm');
        msg.setPlainTextBody('Batch operation Processed :'+job.status);
        Messaging.Email[] emails = new Messaging.Email[]{msg};
        Messaging.sendEmail(emails);    
    }               

}


Please assist. Thanks

 
Hi All
I keep getting the following compile error: Class Update_Currency must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)
and global methods do not support parameter type of List<Opportunity>

FYI, here is my class code
global class Update_Currency implements Database.Batchable<Sobject>{
        global String apiKey;
    global Update_Currency(string apiKey){
        this.apiKey=apiKey;
    }   
      global Database.QueryLocator start(Database.BatchableContext bc){
       String query = 'select Id, Amount, INRValue__c from Opportunity';
       return Database.getQueryLocator(query);
      }
        global void execute(Database.BatchableContext bc, List<Opportunity> optyList){
        Http p = new Http();
        HttpREquest request = new HttpRequest();
        string endPoint = 'http://api.currencylayer.com/live';
        endPoint=endpoint+'access_key='+apiKey;
        endPoint=endPoint+'&currencies=INR&source=USD&format=1';
        request.setEndpoint(endpoint);
        request.setMethod('GET');
        HttpREsponse responce = p.send(request);
        String jsonString= response.getBody();
        System.JSONParser jp=JSON.createParser(jsonString);
        Decimal inrValue;
        while(jp.getText()!=null){
            if(jp.getText()=='USDINR'){
                jp.nextToken();
                inrValue=(Decimal)jp.getDecimalValue();
            }
        }
        for(Opporttunity op:optyList){
            op.INRValue__c = 'Rs'+(op.amount*inrValue);
        }
            update optyList;}
    global void finish(Database.BatchableContext bc){
        AsyncApexJob job =[select id,Status from AsyncApexjJob where Id =:bc.getJobId()];
        Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
        string[] toadd=new string []{'hariom.sfdc@gmail.com'};
        msg.setToAddresses(toAdd);
        msg.setSubject('Intergration First Programm');
        msg.setPlainTextBody('Batch operation Processed :'+job.status);
        Messaging.Email[] emails = new Messaging.Email[]{msg};
        Messaging.sendEmail(emails);    
    }               

}


Please assist. Thanks

 
Hi,

I keep getting the following compile error:

Class LeadProcessor must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)

FYI, here is my class code:

global class LeadProcessor implements Database.Batchable<Sobject>
    {    

    global Database.QueryLocator start(Database.BatchableContext bc) 
    {
        return Database.getQueryLocator([SELECT LeadSource FROM Lead]);
    }

    global void execute(Database.BatchableContext bc, List<Leads> scope){
        // process each batch of records
        for (Leads l: scope) {
             l.LeadSource = 'Dreamforce';
             recordsProcessed = recordsProcessed + 1;
            }
        update scope;
    }    

    global void finish(Database.BatchableContext bc){}    
}

Please assist. Thanks