How do I get the previous field value in the modifiedField method of a Dynamic Ax table?
Asked Answered
A

1

5

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?

Abstinence answered 16/10, 2008 at 18:44 Comment(0)
W
12

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)));
}
Westbrooke answered 16/10, 2008 at 20:23 Comment(2)
I 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?Serrato
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.Westbrooke

© 2022 - 2024 — McMap. All rights reserved.