I don't know if is possible this:
I have a list Form. One field called Exclude is editable (Text 50) and in OnValidate for this field in the Form is called a new Function.
This Function is in the Table with a local variable to the same Table (lvrec). This function do this:
Primary Key in table is "Document No.", "Line No."
lvrec.RESET;
lvrec.SETRANGE("Document No.", DocNo);
lvrec.DELETEALL;
When i input a value in Exclude field in Form, records for the same Document No. are deleted but give this error:
The Sale Detail does not exist.
Identification fields and values:
Document No.='DOC0001',Line No.='10000'
I try CurrForm.UPDATE, RESET... But anything is wrong recovering form record...
Any solution?
0
Answers
You have a code in OnValidate trigger. When you enter something on a form the form, at some point is supposed to update the record you have just changed. But before this happens the code on changed field deletes the record which is just about to be updated...
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
OnModify - Record
OnValidate - Form
Delete Function in Table
Is possible that OnModify is executed the last? In this case... There is no way to do it?
There is a way to do it.. or two. You do not have control over the order in which triggers are executed. But sometimes you can prevent the trigger from being executed. For example by changing the design and avoid modification of the record just before it is supposed to be deleted.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Start by explaining in regular words what you want to accomplish.
RIS Plus, LLC
I suggest you to run your function not on the OnValidate trigger but on the Button OnRun trigger
Dont forget to update from after