Hello all,
I have quite a strange situation: it seems that AutoSplitKey property randomly cause creation of sales line with all attributes copied from some other line.
I don't know the details, but I tried to get as much of them as I could. There is a Sales Order form. There are some lines with reserved items. User sets filter on "No." field, cancel line reservation, deletes line. During this process sometimes system randomly creates new sales line.
Suppose we have the following Sales Order Lines:
Line No. Item No. Qty. Reserved Qty.
10000 Item1 1 1
20000 Item2 2 2
30000 Item3 3 3
User sets filter on Item2, cancels line reservation and deletes line 20000, then does some other stuff (scroll, reset filters, whatsoever) and then we have the following picture:
10000 Item1 1 1
30000 Item3 3 3
40000 Item3 3 3
There is a code on Sales Order form, OnOpenForm trigger:
CurrForm.SalesLines.EDITABLE := FALSE;
This means that user can't create line directly in Sales Order. He can only cancel reservation and delete line. But somehow he creates new lines. Log Change clearly shows that line was created manually by user and not by code. This cause problems. Customer didn't want Item3 with qty 6.
Did anyone faced with such problem before?
P.S: I found how can I override AutoSplitKey property here:
http://www.dynamics.is/?p=248, but I can't figure out what BelowxRec variable is.
Help is very much appreciated!
Answers
An additional condition is
What does the property effect?
When a new record is initialized in a form, the system checks the current record at the time you pressed F3 or performed some other action to cause the system to create a new line. If that Record is an empty line after the last record or the last record itself, it reads the last field of the primary key in the last record, adds 10000 to that value and stores it to the same field in the record to be initialized. If the focus is on some other line, the last field of primary key in the current record and the same field of the next record is added, divided by two and the result stored in the same field of the record to be initialized. These checks and calculations are performed using the current sort order and filter.
You need to set the Form's InsertAllowed property to No in order to prevent inserts. The Editable property does prevent you from just typing on an empty line in order to create a new record, but does not prevent you from using "New".
I am sorry for the late answer. I disabled AutoSplitKey property and created a rotuine on the form which assign Line No. This solved the problem, my customer has not reported me this problem back.
Thank you!