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
rathi007rathi007 

Merge two account based on Last Modified Date

I want to merge two account based on Last Modified Date throw apex

but i am getting some error 

"System.DmlException: Merge failed. First exception on row 0 with id 0019000001ATaTOAA1; first error: INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: LastModifiedDate. Please check the security settings of this field and verify that it is read/write for your profile or permission set.: [LastModifiedDate]"
PratikPratik (Salesforce Developers) 
Hi,

As per the error message, it basically need the permissions. Can you check on permission wheather it profile has Delete permission. Also can you please post the code so we can test.

You can go through this post for reference of similar kind of issue on permission.
http://salesforce.stackexchange.com/questions/11076/adding-contacts-to-campaign-as-campaign-members

Thanks,
Pratik