Skip to main content
siliveru venkatesh 님이 #Apex에 질문했습니다
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.....

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: []User-added image
답변 1개
  1. 2017년 11월 18일 오전 7:03

    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

0/9000