+ 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?