+ Start a Discussion
sandeep reddy 37sandeep reddy 37 

usingbatchapex update lookup field

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){
        
    }
Ravi Dutt SharmaRavi Dutt Sharma
a.newcustmer__c='2015-0037';

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