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
siliveru venkateshsiliveru venkatesh 

Compile Error:Line: 35, Column: 1 System.DmlException: Update failed. First exception on row 510 with id a032800000WgLPXAA3; first error: ENTITY_IS_DELETED, entity is deleted: []

Hi.... ALL 
I need to Update Position Records Whose Max Pay is > 500000 ,I am  Execute this code facing the Compiler Error.
Any one can solve this.....

User-added imageUser-added image
Suraj TripathiSuraj Tripathi

Hi siliveru venkatesh,

You need to update UpdatePosition insteed of pos. Please try this for your code copy. Hope it will help you.

public class DMLUpdate{
	public static void RecordstoUpdate(){
		List<Position__c> pos = new List<Position__c>();
		pos = [Select id, Name, Min_pay__c, Close_Date__c, Max_pay__c from Position__c where Max_pay__c > 500000 ALL ROWS];
		if(!pos.isEmpty()){
			List<Position__c> UpdatePosition = new List<Position__c>();
			for(Position__c po : pos){
				UpdatePosition.add(new Position__c(Id = po.id, Close_Date__c = System.today()));
			}
			if(!UpdatePosition.isEmpty()){
				update UpdatePosition;
			}
		}
	}
}


Mark as a best if it helps you.

Regards,

Suraj