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
Daniel BleasdaleDaniel Bleasdale 

MISSING_ARGUMENT, Id not specified in an update call: [] Testing a null?

User-added imageUser-added image
Best Answer chosen by Daniel Bleasdale
Steven NsubugaSteven Nsubuga
Just as the error message states, add these 2 lines within your save method, just before the upsert.
ApprenticeObj.Programme_Area__c = ProgramArea.Id;
ApprenticeObj.Date_of_Birth__c = date.parse('12/08/2000'); // use any date you like


 

All Answers

v varaprasadv varaprasad
Hi Daniel,

This error is due to save method in the class, at the time updating of apprentice object we need record id.

apprenticeobj.id = 'recordid';

update apprenticeobj;


Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For  Support: varaprasad4sfdc@gmail.com
 
Steven NsubugaSteven Nsubuga
Change line 20 in the Tests class from update apprenticeobj;
to upsert apprenticeobj;
PreyankaPreyanka
Hello Daniel,

You can change your save method as below
 
public PageReference save(){
if(ApprenticeObj != null){
  upsert ApprenticeObj;
} 
return null;
}

Thanks
Preyanka​
Steven NsubugaSteven Nsubuga
Just as the error message states, add these 2 lines within your save method, just before the upsert.
ApprenticeObj.Programme_Area__c = ProgramArea.Id;
ApprenticeObj.Date_of_Birth__c = date.parse('12/08/2000'); // use any date you like


 
This was selected as the best answer