PXAccumulator: Insertion of Values Updated by an Accumulator Attribute
An accumulator attribute triggers only for data records that have the Inserted status in the cache object. Thus, you have to insert a data record into the cache to trigger an update via the accumulator attribute. Once inserted, the data record gets the Inserted status and maintains this status until it is saved to the database, even if you update the record in the cache. When a user saves the changes to the database, even though the record has the Inserted status in the cache object, the framework generates the correct SQL statement that updates the record or inserts it into the database. By default, if there is no record with such a key in the database, a new one is inserted. If a record with these key values already exists, it is correctly updated in the database because of the accumulator attribute.
In an accumulator attribute, you can specify which database operations are allowed. By
default, the accumulator attribute inserts a new record if it does not exist in the database
and updates the existing record, if any. To allow only insert or update operations, set the
InsertOnly or UpdateOnly property of the
columns
collection in the PrepareInsert() method
before you invoke columns.Update().