A new customized field was added to InventSum table called ProductName.
I need to update this field after a new record is inserted to InventSum table.
I tried to update “insert” method exits on InventSum table to inculde this logic. The update does not work all the time ; some time the inserted record does not updated to include ProductName.
Any suggestion please?
Also, would you please provide me with code segment which performs the insertion on the InventSum table , As I understand a record is inserted to InventSum once a recored is inserted to InventTrans.
InventSum table is an aggregation of the inventory transaction, so there will not be an insert always, the existing record gets updated based on the aggregation criteria. InventSumDelta table holds the data(the changes done to inventSum) until it is committed to avoid locking of inventSum records( as this is a widely updated table).
I am not sure why do you need productName on table, You can use \Data Dictionary\Tables\InventSum\Methods\itemName
BTW, look at \Classes\InventUpdateOnhand\updateInventSumSimple
Thank you for your reply.
The actual update is to have “Product Name” field in the 'On-hand inventory" and “On-hand” inquiry and it must be searchable. If the field is retrieved using a display method, this property will not be available so the only solution I found is to add a physical customized field to InventSum table and update this field once a record is inserted using insert method available in InventSum table methods.
As I mentioned before the problem is that the insert method is not fired all the times since some records in InventSum have an empty Product Name field.
Do you think if the same update is added to Update and Write method on InventSum table,the update will work properly?
Just an additional explanation : when the I checked the method mentioned in your post, I note that the method updates a record already exists in InventSum table so when this record is actually inserted and using which method ?
The mentioned method is triggering inventSum.write, which will do an update if record exists otherwise it will do an insert.
See \Classes\InventUpdateOnhand\ttsNotifyPreCommit, for information on the sequence of events that are triggered during the onhand update.