You need to sign in to do that
Don't have an account?
Dagny Fernandes
Error in trigger: MISSING_ARGUMENT, Id not specified in an update call
Hi Frends,
Iam getting the below error in trigger after Update
TicketStatus: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0AO000000Ak6Y6MAJ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TicketStatus: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Class.TicketStatusHandler.onAfterUpdate:
this error is in the line number 65 DML operation update. I added the System debug statement in line number 64 and iam getting the ID of the record. Am i missing anything in the below code. need help ASAP
Thanks in advance.
Iam getting the below error in trigger after Update
TicketStatus: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0AO000000Ak6Y6MAJ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TicketStatus: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Class.TicketStatusHandler.onAfterUpdate:
this error is in the line number 65 DML operation update. I added the System debug statement in line number 64 and iam getting the ID of the record. Am i missing anything in the below code. need help ASAP
Thanks in advance.
//-- After Update public void onAfterUpdate(final List<Escalation__c> newObjects,final List<Escalation__c> oldObjects,final Map<Id, Escalation__c> newObjectsMap,final Map<Id, Escalation__c> oldObjectsMap){ List<Escalation__Share> EscalationShareList = new List<Escalation__Share>(); List<Escalation__Share> EscalationShareListToDelete = new List<Escalation__Share>(); List<Followers__c> FollowersList = new List<Followers__c>(); List<Escalation__c> ParentEscaUpdate = new List<Escalation__c>(); Map<Id,Id> toDeleteShareMap = new Map<Id,Id>(); map<Id, Escalation__c> parentEsca = new map<Id, Escalation__c>(); Escalation__c PrarentRec = new Escalation__c(); for(Escalation__c escaParent: [SELECT Id,Name,Sys_Ticket_Count__c,RecordTypeId FROM Escalation__c WHERE RecordTypeId =: Constants_PicklistVariables.ESCALATION_RECORDTYPE_ID]){ parentEsca.put(escaParent.Id, escaParent); } for(Escalation__c esca: newObjects){ if(esca.RecordTypeId == Constants_PicklistVariables.TICKET_RECORDTYPE_ID && esca.Assigned_To__c != null && esca.Assigned_to__c != oldObjectsMap.get(esca.Id).Assigned_To__c){ Escalation__Share expShare = new Escalation__Share( ParentId = esca.Id, UserOrGroupId = esca.Assigned_To__c, rowCause = Schema.Escalation__Share.rowCause.AssignedTo__c, accessLevel = 'Edit' ); //Adding Followers Followers__c follRec = new Followers__c(); follRec.Follower_Name__c = esca.Assigned_To__c; follRec.Ticket__c = esca.Id; FollowersList.add(follRec); EscalationShareList.add(expShare); toDeleteShareMap.put(esca.Id, oldObjectsMap.get(esca.Id).Assigned_To__c); System.debug('toDeleteShareMap'+toDeleteShareMap); } if(esca.Escalation__c != null) PrarentRec = parentEsca.get(esca.Escalation__c); } if(PrarentRec != null){ List<Escalation__c> TicketRec = [SELECT Id,Name,RecordTypeId,Escalation__c,Category__c,Ticket_Status_Overall_Ops__c,Ticket_Status_Overall_Finance__c,Ticket_Status_Overall_Mar__c,Ticket_Status_Overall_Service__c,Ticket_Status_Overall_Tech__c FROM Escalation__c WHERE RecordTypeId =: Constants_PicklistVariables.TICKET_RECORDTYPE_ID AND Escalation__c =: PrarentRec.Id]; Integer NonClosedTicketCounter = 0; System.debug('TicketRec'+TicketRec); for(Escalation__c tickRec: TicketRec){ if(tickRec.Category__c == null) NonClosedTicketCounter = NonClosedTicketCounter + 1; if(tickRec.Category__c == 'Ops' && tickRec.Ticket_Status_Overall_Ops__c != 'Closed') NonClosedTicketCounter = NonClosedTicketCounter + 1; if(tickRec.Category__c == 'Finance' && tickRec.Ticket_Status_Overall_Finance__c != 'Closed') NonClosedTicketCounter = NonClosedTicketCounter + 1; if(tickRec.Category__c == 'Leads (Marketing)' && tickRec.Ticket_Status_Overall_Mar__c != 'Closed') NonClosedTicketCounter = NonClosedTicketCounter + 1; if(tickRec.Category__c == 'Service' && tickRec.Ticket_Status_Overall_Service__c != 'Closed') NonClosedTicketCounter = NonClosedTicketCounter + 1; if(tickRec.Category__c == 'Tech' && tickRec.Ticket_Status_Overall_Tech__c != 'Closed') NonClosedTicketCounter = NonClosedTicketCounter + 1; } System.Debug('NonClosedTicketCounter'+NonClosedTicketCounter); if(NonClosedTicketCounter == 0){ /*Escalation__c parentRecord = parentEsca.get(PrarentRec.Id) ; parentRecord.Escalation_Status__c = 'Closed'; update parentRecord;*/ PrarentRec.Escalation_Status__c = 'Closed'; System.debug('PrarentRec'+PrarentRec); update PrarentRec; } } for(Escalation__Share expShare :[SELECT Id, ParentId, rowCause, UserOrGroupId FROM Escalation__Share WHERE ParentId in :toDeleteShareMap.keySet()]){ if(toDeleteShareMap.get(expShare.ParentId) != null && toDeleteShareMap.get(expShare.ParentId) == expShare.UserOrGroupId){ EscalationShareListToDelete.add(expShare); } } try{ insert EscalationShareList; insert FollowersList; delete EscalationShareListToDelete; }catch(Exception e){ } }
Looking at your code, I'd say that you should initialise this variable to null - that way you will only attempt escalation processing if the parent record exists.
All Answers
Looking at your code, I'd say that you should initialise this variable to null - that way you will only attempt escalation processing if the parent record exists.