You need to sign in to do that
Don't have an account?
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
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