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
Abid ullahAbid ullah 

Update failed. MISSING_ARGUMENT, Id not specified in an update call:

public class AddPrimaryContact implements Queueable {

    private Contact comingContact;
    private string state;
    
    public AddPrimaryContact(Contact record, string stateabbrivation){
        this.comingContact = record;
        this.state = stateabbrivation;
    }
    
    public void execute(QueueableContext qcon){
        
        List<Account> allAccounts = [SELECT id,Name,(SELECT FirstName,LastName,Id from contacts) from Account
                                     where BillingState=:this.state limit 200];
        List<Contact> contactToUpdate = new List<Contact>();
        
        for(Account acc:allAccounts){
            
            Contact c = this.comingContact.clone();
            c.AccountId = acc.Id;
            contactToUpdate.add(c);
        }
            
        if(contactToUpdate.size()>0){
            system.debug(contactToUpdate);
            update contactToUpdate;
        }
    }
}

and in the execute window:

Contact aContact = [select id,FirstName,LastName from Contact where Id=:'0035f000009OGaqAAG'];
AddPrimaryContact checking = new AddPrimaryContact(aContact,'NY');
system.enqueueJob(checking);

and give error.User-added image
SwethaSwetha (Salesforce Developers) 
HI Abid,
Can you add a system.debug statement for the contactToUpdate and for       c.AccountId and see what is returned

Similar post https://salesforce.stackexchange.com/questions/141288/error-when-update-missing-argument-id-not-specified-in-an-update-call

Thanks