Skip to main content
sandeep reddy perguntou em #Apex
how can we do batch apex updating lookupfield

program is exeuted but requir ment is not met

do this for me

global class batchapexforlookup implements database.Batchable<sobject> {

    list<custmer__c> c;

    global void batchapexforlookup(){

        c=new list<custmer__c>();

    }

    global database.Querylocator start(database.batchablecontext bc){

        return database.getQueryLocator('select area__c,digit__c,newcustmer__r.Name from application__c');

    }

    global void execute(database.batchablecontext bc,list<application__c> app){

        for(application__c a:app){

            a.newcustmer__c='2015-0037';

                    }

        update app;

    }

    global void finish(database.BatchableContext bc){

        

    }

} 
1 resposta
  1. 7 de abr. de 2016, 06:48
    a.newcustmer__c='2015-0037';

    The above line will not work. You need to pass the record id instead of record name.