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
Gareth DaviesGareth Davies 

Bug in update?

I think I found a bug in the version 9 AJAX library.

I am trying to update a record of a custom object type.
The "Name" of the custom object type is set to be an auto-generated ID.

Sequence:
    Retrieve() the required columns of obejct using ID.
    This includes the Name field.
    Update() a field (in this case "collected amount").

    The update() call callbacks to my onSuccess handling function (i.e. no error reported) but the update fails.

If I remove the Name field from the object (by creating a new one and setting ID) then there is no issue everything works as expected.

I am not affected by this error now, but I think the API / AJAX code is not throwing on the attempt to update the auto generated NAME field which makes the update call fail.

   
cheenathcheenath
This is the expected behavior. onFailure will be called only if
the server returns a SOAP fault. Since many records can be
update in one call, server returns a save result array with the
success field set to true/false. After the update call, you have
to loop through the save result array and make sure that all
updates are successful.

You can find an example of update in Ajax Tools.

HTHs,


cheenathcheenath
After the update call, you have to loop through the save result array
and make sure that all updates are successful.

In the async case you have to check for errors in the onSuccess
callback method.




Gareth DaviesGareth Davies
Thanks for that - that is what I am seeing and that is the way to deal with it.
When I miss-name a field, however, then it will throw an error.
Oh well, glad I found it now - I can deal with it now.

Thanks for your speedy help!

Best
Gareth.