+ Start a Discussion
Jim MontgomeryJim Montgomery 

Getting error MISSING_ARGUMENT, Id not specified in an update call: []: ()

Here is my code. I cannot see where I am missingthe ID.

trigger ProductConfigExtendedmaintenance on Apttus_Config2__ProductConfiguration__c (after insert, after update) {

   Set<Id> proposalIds = new Set<Id>();
List<Apttus_proposal__proposal__c> proposalsToUpdate = new List<Apttus_proposal__proposal__c>();

for(Apttus_Config2__ProductConfiguration__c prop :Trigger.new){
    proposalIds.add(prop.Id);
}
proposalIds.remove(null);
for(AggregateResult ar :[SELECT Proposal_ID__c, MAX(extended_maintenance_max_rollup__c) maxMonths
            FROM Apttus_Config2__ProductConfiguration__c
            WHERE Id IN :proposalIds
            GROUP BY Proposal_ID__c]){    
    proposalsToUpdate.add(new Apttus_proposal__proposal__c(
        Id = (Id)ar.get('Proposal_ID__c'),        
        extended_maintenance_months__c = (Decimal)ar.get('maxMonths')
    ));
}

update proposalsToUpdate;
    
  }
Raj VakatiRaj Vakati
Your code looks good for me and try like this 
 
trigger ProductConfigExtendedmaintenance on Apttus_Config2__ProductConfiguration__c (after insert, after update) {

   Set<Id> proposalIds = new Set<Id>();
	List<Apttus_proposal__proposal__c> proposalsToUpdate = new List<Apttus_proposal__proposal__c>();

	for(Apttus_Config2__ProductConfiguration__c prop :Trigger.new){
		proposalIds.add(prop.Id);
	}
for(AggregateResult ar :[SELECT Proposal_ID__c, MAX(extended_maintenance_max_rollup__c) maxMonths
            FROM Apttus_Config2__ProductConfiguration__c
            WHERE Id IN :proposalIds
            GROUP BY Proposal_ID__c]){  
if(	(Id)ar.get('Proposal_ID__c')!=NULL || (Id)ar.get('Proposal_ID__c')!=''){	
		proposalsToUpdate.add(new Apttus_proposal__proposal__c(
			Id = (Id)ar.get('Proposal_ID__c'),        
			extended_maintenance_months__c = (Decimal)ar.get('maxMonths')
		));
}
}

update proposalsToUpdate;
    
  }

 
Jim MontgomeryJim Montgomery
Same error
Raj VakatiRaj Vakati
Can you check in debug logs what you are getting ?? 
Jim MontgomeryJim Montgomery
Thanks for all of your help!
The Proposal_ID__c field was not populated with an ID. There was another field that had the correct ID in it.
Duh on me!