I would like to be able to perform some logic in the table.modifiedField method which compares the previous value of a field to the new value. How do I get to the previous value?
Asked
Active
Viewed 2.2k times
1 Answers
11
The record buffer as it was before any modifications is available through the this.orig()
method.
public void modifiedField(fieldId _fieldId)
{
super(_fieldId);
info(strfmt("Field number %1 changed from %2 to %3",_fieldId,this.orig().(_fieldId),this.(_fieldId)));
}

Jay Hofacker
- 3,439
- 20
- 14
-
1I want to get the previous changed value of the field. In other words, not the previously saved value. If I change the same field twice, from "A" to "B" and then from "B" to "A" without saving in the middle, orig() will return "A" as the previous value the second time, while I am looking for "B". Can this be done in Ax? – Wessel du Plooy Sep 08 '15 at 13:11
-
Without saving, the field in the table wasn't modified, so you will never see "B". You can override the textChange method on a control on a form, then you can capture every letter typed by the user as they type it. – Jay Hofacker Sep 23 '15 at 03:03