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
MamathaMamatha 

Unable to Update Account ID


I am trying to update Account ID of a Contact. But I am getting error that IS is not specified. Can any one help me with this.

Here is the code fragment:

queryResult_Task = bindingStub.query("select Customer_Type__c, Email,FirstName, MailingCity, MailingPostalCode, MailingState, MailingStreet, Phone, LastName, AccountId from Contact where CreatedDate >"+ date3 +" and LastModifiedDate <"+ date11+ " and AccountId = ''");

if(queryResult_Task.getRecords()!=null)
   {
    for(m=0;m<queryResult_Task.getRecords().length;m++)
     {

     
     Contact contact= (Contact)queryResult_Task.getRecords(m);
     ID Accountid= contact.getAccountId();
     ID recordtype=contact.getRecordTypeId();
     
     if(contact.getAccountId()==null)
      { 

      ID id_account = new ID();
      id_account.setValue("00130000004MQtB");
      contact.setAccountId(id_account);     
      
      SObject[] sObjects12 = new SObject[1];
      // Add the accounts to the SObject array
      sObjects12[0] = contact;          
      // Invoke the create call
      SaveResult[] saveResults12 = bindingStub.update(sObjects12);
      System.out.println("before for loop save result length " + saveResults12.length);   
  
       // Handle the results
       for (int m=0;m<saveResults12.length;m++)
      {
      System.out.println("inside for " + saveResults12[0].isSuccess());               
       // Determine whether create succeeded or had errors
       if (saveResults12[m].isSuccess())
      {      
        System.out.println("Object created");      
       }
       else
      { Error err1 = saveResults12[m].getErrors()[0];
        System.out.println("Error code: " + err1.getStatusCode() + " Error Message: " + err1.getMessage());
        System.out.println("Object is not created");
       }
      }
      }
     }
   }

 

Here is the error code:

Error code: MISSING_ARGUMENT Error Message: Id not specified

NewhereNewhere

Hi,

Since you are update the Contact, you would need to pass the Contact Id also. Maybe the message says that the Contact Id is missing.

Preeti