+ Start a Discussion
Rakesh SRakesh S 

MISSING_ARGUMENT, Id not specified in an update call: []

Hi All,
executing this in anonymous block.
 
List<Log_book__c> lbc = [Select id,Subject__c, Level__c, Week__c,Student__c,Subjects_Registered__c from Log_Book__c];
             List<Log_Book__c> needToUpdate=new List<Log_Book__c>();
       for(Log_Book__c slws : lbc){
           Log_Book__c c = new Log_Book__c();
              String s1 = slws.Subject__c+':'+slws.Level__c+':'+slws.Week__c;
             Subjects_Levels_and_Weeks__c slw1=Subjects_Levels_and_Weeks__c.getinstance(s1);
              if(slw1!=null){
               c.id = slws.id;
               c.isExam__c=true;
               c.Exam__c=slw1.Exam__c;
              // c.Student__c=slws.Student__c;
                  //  c.Subjects_Registered__c=slws.Subjects_Registered__c;
             }
          needToUpdate.add(c);
          }
update needToUpdate;

getting error like  MISSING_ARGUMENT, Id not specified in an update call: [].

Please let me know how i can resolve this problem.


thank you..
Shyama B SShyama B S
Hi Rakesh,

Can you provide more details on this - What is the relationship between Subjects_Levels_and_Weeks__c and Log_book__c?

Thanks,
Shyama
Amit Chaudhary 8Amit Chaudhary 8
Hi Rakesh,

Please try below code. I hope that will help you

Example 1:-
List<Log_book__c> lbc = [Select id,Subject__c, Level__c, Week__c,Student__c,Subjects_Registered__c from Log_Book__c];

       List<Log_Book__c> needToUpdate=new List<Log_Book__c>();
	   
       for(Log_Book__c slws : lbc)
	   {
           Log_Book__c c = new Log_Book__c();
              String s1 = slws.Subject__c+':'+slws.Level__c+':'+slws.Week__c;
             Subjects_Levels_and_Weeks__c slw1=Subjects_Levels_and_Weeks__c.getinstance(s1);
              if(slw1!=null)
			  {
               c.id = slws.id;
               c.isExam__c=true;
               c.Exam__c=slw1.Exam__c;
					// c.Student__c=slws.Student__c;
                  //  c.Subjects_Registered__c=slws.Subjects_Registered__c;
				needToUpdate.add(c);
             }
       }
if(needToUpdate.size() > 0 )
{
update needToUpdate;
}
Example 2
List<Log_book__c> lbc = [Select id,Subject__c, Level__c, Week__c,Student__c,Subjects_Registered__c from Log_Book__c];

       List<Log_Book__c> needToUpdate=new List<Log_Book__c>();
	   
       for(Log_Book__c slws : lbc)
	   {
             String s1 = slws.Subject__c+':'+slws.Level__c+':'+slws.Week__c;
             Subjects_Levels_and_Weeks__c slw1=Subjects_Levels_and_Weeks__c.getinstance(s1);
              if(slw1!=null)
			  {
               slws.isExam__c=true;
               slws.Exam__c=slw1.Exam__c;
			   needToUpdate.add(slws);
             }
       }
	if(needToUpdate.size() > 0)
	{	
		update needToUpdate;
	}

Please let us know if this will help u

Thanks
Amit Chaudhary