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
MaxploreMaxplore 

Unable to update custom object

Hi,
 
I am trying to update a custom object using "update" method. Though I am able to create new records in this object. Here is the piece of code I am using:
 
 var acc1:SObject = new SObject('RMA_Shipment_Line__c');
 acc1.Id = "a0e500000004dLlAAI";
 apex.update([acc1], new AsyncResponder(
     function (result:Object):void {
//      var strId:String = (result[0] as SaveResult).success;
      
      Alert.show((result[0] as SaveResult).errors[0].message);
      //Alert.show(strId);
    }, genericFault
   ) );
 
 
  
}
MaxploreMaxplore
Continuattion....
 
I checked the "success" property and it is false. I checked the errors collection but it is empty.
The Id mentioned in my example is a valid ID.
 
This object is a child object to an object. I wonder if that has something to do with the problem.
I am able to create/update/delete in the parent object.
 
In this object, create and delete is working but update is not working.
Can anyone give me some leads on this?
 
SteveBowerSteveBower
Random thought... you don't appear to be updating any field values.  Perhaps that has an impact.  -S
MaxploreMaxplore

I tried putting all the fields and then started removing them one by one so as to check whether a particualr field is causing error.

But no luck.

I think problem is something else..

Ron HessRon Hess
can you dump out the result object, something like this
 
private function updResult(result:Object):void
   {
       ta.text = 'update Result\n' + ObjectUtil.toString(result);
  
   }
 

also, you may have to update one or more fields.
which library version do you have?

Message Edited by Ron Hess on 08-23-2007 07:39 AM

MaxploreMaxplore

Its solved.

I was using wrong Id to update the field.

Ron HessRon Hess
still, the service should have given you a proper error message or fault, i'm supprised you were not able to find the error or fault that was passed back.
MaxploreMaxplore

I was using wrong methods for fetching the errors.

When I corrected that and started getting the error from the API, its then only I fugured that I am using wrong Id.

So, everything is working fine :-)

Thanks!