You need to sign in to do that
Don't have an account?
Praz
System.FinalException: Record is read-only
Hi,
I have written a trigger and the error is comng at the line it is highlighted
The fields here highlighted are the lookup of User object.
trigger UpdateMarkRequestTrigger on Marketing_Request__c (before update) {
if(Trigger.isBefore){
if(Trigger.isUpdate){
for(Marketing_Request__c mr:Trigger.old){
System.debug(Logginglevel.INFO,mr.Name);
if(mr.Status__c=='Review Completed')
System.debug(Logginglevel.INFO,mr.Status__c);
System.debug(Logginglevel.INFO,mr.Project_Owner__c);
System.debug(Logginglevel.INFO,mr.Reassign_To__c);
mr.Reassign_To__c=mr.Project_Owner__c;
System.debug(Logginglevel.INFO,mr.Project_Owner__c);
System.debug(Logginglevel.INFO,mr.Reassign_To__c);
}
}
}
Help will be appreciated
Regards
Praz
You have to use Trigger.New not the Trigger.old
But this is an existing record...
Trigger.old means these will capture the previous values (before change) and trigger.new will capture the new values what user has updated
Can you make the trigger to "After update" instead of "before update." I don't see the reason why the trigger is before update. This should resolve the issue.
Sorry for the half answer before.
Here is the code that i would recommend
same exception!!!