I am getting "System.ListException: Duplicate id in list: " in After trigger.How to prevent this.I am trying to update the same record after callout in after trigger.Below is my piece of code:
List<Patient_Package__c> lockPackage = new List<Patient_Package__c>();
if(trigger.new[index].Approval_Status__c=='Approved'){
lockPackage.add(new Patient_Package__c( id=trigger.new[index].id,ECC_Sync_Status__c=label.PMM_ECC_STATUS_Processing));
try{
ECC_protocol_Sub_Callout.ecc_protocol_subscription(string.ValueOf(trigger.new[index].id));
lockPackage.add(new Patient_Package__c( id=trigger.new[index].id,Approval_Status__c=''));
}catch(exception e){
PMM_Exception_DAO.insertExceptionRecord(e,'ECC_Onboarding_Callout','ecccallout');
system.debug(e.getmessage());
}
}
if(lockPackage!=null && !lockPackage.isEmpty()){
update lockPackage;
}
Approval_Status__c
values. Are you trying to clear it out or set it to theCustom Label
value? You can't do both.