function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DFDF 

Changing Records LastModifiedBy...any suggestions on why this isn't working ?

trigger Testmodify on Lead (after update) { User [] umail = [Select u.Email,u.Name from User u where id=:Trigger.new[0].OwnerId]; Lead [] lid = [Select Id from Lead where id=:Trigger.new[0].Id]; for (Lead tmp:lid) { tmp.LastModifiedById = umail[0].Id; update tmp; } }

 

Any ideas on why this code isn't being saved to the server ?

Best Answer chosen by Admin (Salesforce Developers) 
jkucerajkucera
I'm pretty sure LastModifiedBy is not updatable as it's a system field.  You can confirm in the API doc's.

All Answers

jkucerajkucera
I'm pretty sure LastModifiedBy is not updatable as it's a system field.  You can confirm in the API doc's.
This was selected as the best answer
Greg HGreg H

John is correct, the LastModifiedById is a system field and cannot be updated via trigger.
-greg

DFDF
Any ideas on how I can get a Mass email being triggered by an update to send from the owner of a record instead of the last modifier?