You need to sign in to do that
Don't have an account?
Peter McGavin
Class LeadProcessor must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)
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
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
Please update your code like below Please check below post for same issue
1) https://developer.salesforce.com/forums/?id=906F0000000D9AUIA0
Let us know if this will help you
All Answers
Please update your code like below Please check below post for same issue
1) https://developer.salesforce.com/forums/?id=906F0000000D9AUIA0
Let us know if this will help you
i keep getting below error,
1.Class Opty_Currency_Update must implement the method: void Database.Batchable<SObject>.execute(Database.BatchableContext, List<SObject>)
2.global methods do not support parameter type of List<Opportunity>
my class code
:
global class Opty_Currency_Update implements Database.Batchable<Sobject> ,Database.Stateful{
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+'¤cies=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);
}
}
anony code
String apiKey ='5d35e4d851ea10c97a4621db93d9bc32';
Opty_Currency_Update op = new Opty_Currency_Update(apikey);
Database.executeBatch(op);
error:
Line: 2, Column: 27
Constructor not defined: [Opty_Currency_Update].<Constructor>(String)
Thanks