You need to sign in to do that
Don't have an account?
mh@reed
Insert error handling
Scenario: inserting an object into the database that causes an error.
I'm confused by the options here. If I use a try/catch block, I can gracefully handle and report the error - great. What happens if I'm doing the following (without the use of a try/catch block):
Database.SaveResult[] results = databse.insert(sObject);
If the insert fails, does the code crash or can I then iterate through the SaveResult array, test for an error and then report it?
Should both methods be used at the same time and what happens if they are?
if the insert fails it will go to the next conditional block like
if(pass){
}
else{
it will come in to this if fails..u can perform the failed logic here....
}
i didn'get you in this line "Should both methods be used at the same time and what happens if they are?"
Answered this one myself. You need to use a try/catch block to catch any unexpected error - seems obvious now...
ya for sure...