Activity Forums Salesforce® Discussions Record is read-only error

  • Suyash

    Member
    April 30, 2016 at 7:41 am

    Hi Gaurav,

    I think you are updating your triggered records directly in after trigger.
    for ex:
    for(Sobjecttype obj: trigger.new){

    obj.fieldApiName__c='Updated value';

    update obj;

    }

    You cannot do this in After trigger as Trigger.new is read only. To update it you need to query the records from the sObject which are having their ids in trigger.new.

    Hope it helps
    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos