• yaakov
  • NEWBIE
  • 35 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am trying to create tasks through the webservice API. I have code that looks something like this:

List<sObject> objs = new List<sObject>;
foreach ... {
  Task task = new Task();
  task.AccountId = accountID;
  task.WhatId = opportunityID;
  task.Subject = subject;
  task.Description = description;
  task.ActivityDate = date;
  task.IsClosed = isComplete;
  task.Priority = "Normal";
  task.Status = (isComplete) ? "Completed" : "In Progress";
  objs.Add(task);
}

sObject[] objArray = objs.ToArray();
SaveResult[] resArray = new SaveResult[objs.Count];
DebuggingInfo debInfo = binding.create(sessionHeader, new AssignmentRuleHeader(), new MruHeader(), new DebuggingHeader(), new EmailHeader(), objArray, out resArray);


The accountIds and opportunityIds were retrieved earlier in the code through the API. I have confirmed that they are valid IDs, referring to the correct accounts and opportunities that already exist in the DB.

For each task that I try to inset, I receive the following error message:
Error code is: INVALID_FIELD_FOR_INSERT_UPDATE
Error message: Unable to create/update fields: AccountId. Please check the security settings of this field and verify that it is read/write for your profile.
The error code and message seem to imply that I cannot create a task with an accountId. This seems strange, as I want to relate the task to the accountId.

Any idea on what the error message means, and how I can fix this so that I can insert tasks into the DB through the API? (And regarding the instruction to check the security settings of this field, etc, I have done some poking around in my account and I could not find where to do this, if this would indeed solve my problem).

Thanks!


Message Edited by yaakov on 03-04-2008 11:26 PM
  • March 05, 2008
  • Like
  • 0
I am trying to create tasks through the webservice API. I have code that looks something like this:

List<sObject> objs = new List<sObject>;
foreach ... {
  Task task = new Task();
  task.AccountId = accountID;
  task.WhatId = opportunityID;
  task.Subject = subject;
  task.Description = description;
  task.ActivityDate = date;
  task.IsClosed = isComplete;
  task.Priority = "Normal";
  task.Status = (isComplete) ? "Completed" : "In Progress";
  objs.Add(task);
}

sObject[] objArray = objs.ToArray();
SaveResult[] resArray = new SaveResult[objs.Count];
DebuggingInfo debInfo = binding.create(sessionHeader, new AssignmentRuleHeader(), new MruHeader(), new DebuggingHeader(), new EmailHeader(), objArray, out resArray);


The accountIds and opportunityIds were retrieved earlier in the code through the API. I have confirmed that they are valid IDs, referring to the correct accounts and opportunities that already exist in the DB.

For each task that I try to inset, I receive the following error message:
Error code is: INVALID_FIELD_FOR_INSERT_UPDATE
Error message: Unable to create/update fields: AccountId. Please check the security settings of this field and verify that it is read/write for your profile.
The error code and message seem to imply that I cannot create a task with an accountId. This seems strange, as I want to relate the task to the accountId.

Any idea on what the error message means, and how I can fix this so that I can insert tasks into the DB through the API? (And regarding the instruction to check the security settings of this field, etc, I have done some poking around in my account and I could not find where to do this, if this would indeed solve my problem).

Thanks!


Message Edited by yaakov on 03-04-2008 11:26 PM
  • March 05, 2008
  • Like
  • 0