Skip to main content
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

You can add an error to a specific field using the addError method as follows:

SObject someRecord;
someRecord.SomeField__c.addError('Custom Message');
//or
someRecord.someField__c.addError(someException);

Note that you cannot add it to a field dynamically. This error mapping can only be done with a hard-coded field. See also:

You can add an error to a specific field using the addError method as follows:

SObject someRecord;
someRecord.SomeField__c.addError('Custom Message');
//or
someRecord.someField__c.addError(someException);

Note that you cannot add it to a field dynamically. This error mapping can only be done with a hard-coded field. See also:

You can add an error to a specific field using the addError method as follows:

SObject someRecord;
someRecord.SomeField__c.addError('Custom Message');
//or
someRecord.someField__c.addError(someException);

Note that you cannot add it to a field dynamically. This error mapping can only be done with a hard-coded field. See also:

Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

You can add an error to a specific field using the addError method as follows:

SObject someRecord;
someRecord.SomeField__c.addError('Custom Message');
//or
someRecord.someField__c.addError(someException);

Note that you cannot add it to a field dynamically. This error mapping can only be done with a hard-coded field. See also: