+ 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;
            update contactToUpdate;

and in the execute window:

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

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