+ Start a Discussion
BidunBidun 

Rrcord is read only.

Hello ,

 

I was trying to change the value of the Leadstatus in After Insert.

 

Having changed the status of a set of leads in one method i made a call to the next one. 

 

But this does not work. I sends out an Exception: Reacord is read only

 

Can some one please help me on this.

 

 public static void afterInsertLeadTrigger(List<Lead> newLeads) {
        // Process Leads after Insert Process
        system.debug('Check IsError:' + isError);
        if(!isError){
            method1(newLeads);
            method2(newLeads);
        }else{
            isError = false;
        }
    }

 

Thanks

Bidun

Best Answer chosen by Admin (Salesforce Developers) 
Sonali BhardwajSonali Bhardwaj

You cannot fire DMLs in after insert on the same record. You have to use before insert trigger.