Avoid Revalidating Known Valid Data
Normally your business logic will use the equals sign assignment operator to set a single field's value, or use the setAttributeValuesFromMap() or createRowAndInitFromMap() functions to set two or more field values in bulk.
Any fields assigned through these methods will be validated by any field and object-level validation rules that are defined to ensure that the business object data saved to the database is always 100% valid.
On special occasions, you may know that the value your code assigns to a field is already
valid. In cases where you are 100% certain the value being assigned to a field is valid, you can
consider using the populateValidAttribute()
function to knowingly assign a valid
value to a field without causing additional validation to occur.
// NOTE: Consciously assigning a known-valid value
// ~~~~ without further validation!
order.populateValidAttribute('OrderStatus','CLOSED')