Below are the code for get success and Error message
try{
//inserting share record
Database.SaveResult[] accountInsertResult = Database.insert(shares,false);
for( Database.SaveResult s: accountInsertResult)
{
if(s.isSuccess())
{
System.debug('Saved');
}
list<database.Error> err= s.getErrors();
for(database.Error d: err)
{
system.debug('Error message is: '+ d.getmessage());
}
}
}
catch(Exception e)
{
system.debug('Exception: '+e);
}
}
No comments:
Post a Comment