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
muralimurali 

update the Task Values using Partner API

hi...

I m using Partner API.
while Updating the Task values into SF. It is Showing "Unable to create/update fields: IsClosed, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp. Please check the security settings of this field and verify that it is read/write for your profile".

I m updating the values are OwnerId,ActivityDate,Priority,Status,Subject,Description,WhoId,WhatId and some custom fields.

i m passing Activity Date in terms of YYYY-MM-DD


Example....

First I m using describeSobject result:

DescribeSObjectResult dsr = oSforceP.describeObjectResult("Task");

string strDataType = CreateSelectList(dsr);/// these are the datafields.

sObject[] objUpdatedTask = oSforceP.getObjectFieldusingID(strDataType,TaskId,"Task");// here i m getting Task Values for particular Id.


Here I m assigning Updated values....

if(objUpdatedTask[0].Any[4].LocalName=="ActivityDate")
objUpdatedTask[0].Any[4].InnerText =strFinalDate;

if(objUpdatedTask[0].Any[7].LocalName=="OwnerId")

objUpdatedTask[0].Any[7].InnerText = ddlAssignTo.SelectedItem.Value;

if(objUpdatedTask[0].Any[6].LocalName=="Priority")
objUpdatedTask[0].Any[6].InnerText = ddlPriority1.SelectedItem.Value;


activityUpdated = oSforceP.updateAllTaskObject(objUpdatedTask[0]);


updateAllTaskObject is another function:

public bool updateAllTaskObject(sObject update_task)
{
bool bRet = false;
try
{
SaveResult[] saveResults = oSforceP.update(new sObject[] {update_task});
if(saveResults != null)
{
bRet = saveResults[0].success;
}
}
catch(Exception e)
{
bRet = false;
throw e;
}
return bRet;

}

I m getting Error Message as "Unable to create/update fields: AccountId, IsClosed, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp. Please check the security settings of this field and verify that it is read/write for your profile."

Please give me a solution for this thing.

thanks and regards,
Murali

Message Edited by murali on 01-02-2006 04:33 AM

Message Edited by murali on 01-02-2006 04:38 AM

SuperfellSuperfell
It appears that you're retrieving all the field values, changing a couple then sending it back as an update, that means all the values you retrieved are in the update message, and so cause an error when one of them is a read only field.
You should construct a new sObject that just contains the fields you want to change for the update call.
muralimurali
i got the logic... thanks for giving Idea.

murali
devVavnidevVavni

hi

 

I am not able to update task using APIs ...

 

Below is the code 

 

SaveResult[] saveResults = binding.update(new Task[] {task, null });

 

where task is task object having data with updated values 

 

Please guide