Accessing Original Value of Field

I thought I came across a macro at one time that gave the original value of a field. I can’t seem to find what I need now.

I want to check the original value of a field onAfterUpdate (or onBeforeUpdate) to see if the field changed. If the original value was No, and the new value is Yes, I want to do something onAfterUpdate.

Other than doing a query on the value onBeforeUpdate, is there a macro that I can use to find the original value of the field?


Not if it has changed, apart from doing the query ‘by hand’ since it likely hasnt saved yet.

I didn’t find exactly what I wanted, but this will work OK during onBeforeUpdate -

if (sc_changed({approved}) && {approved} == ‘Yes’) {
{approved_date} = sc_date(date(‘Ymd’), “yyyymmdd”, “-”, 0, 0, 0);

This macro returns true if the field has changed from its original status.

It does not work too well on the editable grid if you change several times in one session, but should work for most cases.

Right now the solution is


if ( $this->nmgp_dados_form[field] != {field} and !empty( {field} ) ) {
echo ‘The value is different’;