I have an employee that had a line deleted from her purchase order and wanted to know who and when.
I couldn’t find anything useful to tell her.
I suggested enabling the change log to track for future.
I did a test in my test database and found it doesn’t tell you when a line has been deleted, Just some totals have changed.
Is there a way to track this?
Funny enough, if you add a line, it creates a new change log record that starts with: New Record
I tell my customers never delete a PO unless the entire order was entered by mistake. Instead, it is a much better business process to Close the line(s) and/or release(s). Adding a comment or memo about “why” is also important for audit purposes. Closing lines/releases is also captured in the change log (when enabled).
I created a new Pre-Processing Method Directive (Erp.PO.Update)
in Design, hooked ‘Start’ to ‘Condition’.
Added condition: The ‘ttPODetail.RowMod’ field of ‘the deleted row’ ‘is equal to’ the “D” expression
Hooked true condition to ‘Fill Table by Query’.
Hooked ‘Fill Table by Query’ to ‘Invoke External Method’.
Set up ‘Invoke External Method’ like this:
a. Invoke ‘Ice.UD01.UpdateExt’ BO method with ‘specified’ parameters.
b. specified parameter:
Name
Type
Direction
Binding
ds
UpdExtUD01Tableset
in-out
var: UD01LogRecords
continueProcessingOnError
bool
in
expr: false
rollbackParentOnChildError
bool
in
expr: true
errorsOccurred
bool
out
[ignore]
< return value >
BOUpdErrorTableset
out
[ignore]
Set up ‘Fill Table by Query’ like this:
a. Use the ‘POLineDeleted’ query to insert data into the ‘UD01LogRecords.UD01’ table with ‘configured’ mapping
b. POLineDeleted: add ttPODetail table, add these fields:
expr: string.Format("PO {0} - Line {1}: Part #: {2} with Qty: {3} was deleted by {4} on {5}",
queryRow.ttPODetail_PONUM,
queryRow.ttPODetail_POLine,
queryRow.ttPODetail_PartNum,
queryRow.ttPODetail_OrderQty,
callContextClient.CurrentUserId,
BpmFunc.Now() )
Character02
string
field: ttPODetail_PartNum
Character03
string
expr: callContextClient.CurrentUserId
Number01
decimal
field: ttPODetail_OrderQty
I then saved it all and tested by deleting a line from the PO. I wrote a simple BAQ to pull the data from the UD01 and it looks like a winner.
Hopefully this will help someone in the future who would like to write data to a UD table for tracking.