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
alaschgarialaschgari 

Database.SaveResult doesn't show Id in case of error

Dear folks,

See the difference:

 

Database.SaveResult[getErrors=();getId=a0dD0000006nlVsIAI;isSuccess=true;]

Database.SaveResult[getErrors=(Database.Error[getFields=();getMessage=Signature Type wrong;getStatusCode=FIELD_CUSTOM_VALIDATION_EXCEPTION;]);getId=null;isSuccess=false;]

 

Why am I not able to see the Id for the record that failed?

 

Thanks,

Josh

 

 

Anoop AsokAnoop Asok

Hey Josh,

If you're performing an insert, and if the operation failed, there wouldn't be an id to be reported back as the record was not created in the first place.

 

Thanks,
Anoop Asok

alaschgarialaschgari

Hi Anoop,

thank you for your fast answer! Sorry I didn't mention that I perform only updates in this case. Any idea why it doesn't show up for an update of the record?

 

Cheers,

Josh

alaschgarialaschgari

Hey folks,

any new ideas relating this topic?