• wchoy
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

I'm having an issue where when I perform a dml operation on a sobject list, I lose field level information when catching the dml exception.  Does anyone know a work around for this issue?

 

Here is a quick example.

 

List<SObject> obj = [SELECT SomeField__c FROM CustomObject__c];

 

try

{

    update obj;

}

catch (DmlException e)

{

    // catching a field level validation 

    e.getDmlFields(0); //this returns null

}

 

Thanks!

  • September 19, 2013
  • Like
  • 0

I'm having an issue where when I perform a dml operation on a sobject list, I lose field level information when catching the dml exception.  Does anyone know a work around for this issue?

 

Here is a quick example.

 

List<SObject> obj = [SELECT SomeField__c FROM CustomObject__c];

 

try

{

    update obj;

}

catch (DmlException e)

{

    // catching a field level validation 

    e.getDmlFields(0); //this returns null

}

 

Thanks!

  • September 19, 2013
  • Like
  • 0

I'm getting the following error when updating a list custom setting that's part of a managed package:

 

Update failed. First exception on row 0 with id a0DA0000007MfC9MAK; first error: FIELD_INTEGRITY_EXCEPTION, There is already an item in this list with the name

 

I've only recently started seeing this and simply cannot see how this is possible. The code is very simple, retrieve the custom setting, change a field, and then update (not insert). Nowhere am I touching the id or name of the returned object. Example:

 

MySetting__c mysetting = MySetting__c.getValues('TestName');

mysetting.MyField__c = 'test';

update mysetting;

 

Any insights as to why this would happen?