I am getting subject error with below code. The line number is on update statement conditional if clause. But I can't get why I am getting such error? I have a trigger validation for those Call2_vod__c records whose Status field value is Submitted_vod. So I try to deal with only those records for whom I have set ESR_CALL__C field value as true in current run. Can someone help please? Please let me know if you need further info


global class AckCallUpdatenew implements Database.Batchable { global Database.QueryLocator start(Database.BatchableContext BC) { String query = 'SELECT Id,Name,Account_vod__c,Call_Date_vod__c,ESR_Call__c,Unlock_vod__c FROM Call2_vod__c where ESR_Call__c=null and Recordtype.Name like \'%Sample%\' and Status_vod__c = \'Submitted_vod\''; return Database.getQueryLocator(query); }

global void execute(Database.BatchableContext BC, List<Call2_vod__c> scope) {

List<Call2_vod__c> AckCall= 
        [SELECT  Ack_For_Call_abv__c  
                  FROM Call2_vod__c
                 where  recordtype.Name like '%Acknowledge%'];

// Set resultIds = (new Map(AckCall)).keySet();
Set s1 = new Set();

  for(Call2_Vod__c record:AckCall) {
     for(Call2_vod__c a : scope)
              if(a.ESR_Call__c==false && a.Call_Date_vod__c+90<date.today())
               // a.Status_vod__c='Saved_vod';



       else continue;

                 //Date d=a.Call_Date_vod__c+90;


        update scope;

global void finish(Database.BatchableContext BC) {



Data type of scope is list and you are trying to access field of record without any index.

Something like this should work Scope[0].fieldname__c

You will need to provide correct index as per logic. I have used 0 just to explain.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.