You need to sign in to do that
Don't have an account?
Database.SaveResult won't provide id for failed update operation
I am testing a webservice that accepts a list of Asset Ids, changes each asset.Status to "Active."
When there is any kind of error on the DML update, the saveresult does not provide me with the Id. Here's an example; the asset has been deleted.
20100202213448.608:Class.AssetActivateWS.activateAssets: line 35, column 13: Database.SaveResult[getErrors=(Database.Error[getFields=();getMessage=entity is deleted;getStatusCode=System.StatusCode.ENTITY_IS_DELETED;]);getId=null;isSuccess=false;]
I can add code to generate the id myself, but it seems strange (a bug even) that SaveResult.getId returns null if saveResult.isSuccess is false.
Any insights?
Not a bug -- this behavior is by design.
See http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_update_saveresult.htm.