Add a default value to a hidden record while adding record

I would like to add a default value to a field without showing that field in the add form. When a user logs in and add a new record I want that field in the record that it is not showed to be saved with a default value.

This is what I am using but it is not working:

Under Tabe Specific → Record_Inserted I put this:

function Row_Inserted($rsold, &$rsnew) {
Execute(“UPDATE ChangeMGMT SET Approval = 0 WHERE ChangeID = “.$rsnew[“ChangeID”].””);
}

I tried rsnew and rsold but the field comes up empty. No error and the record gets added.

How can this be fixed?

No need to use “Row_Inserted” server event. Simply put this following code in “Row_Inserting” server event:

$rsnew[“Approval”] = “0”;

Alternatively, you may also set the default value to “0” for “Approval” field from your database side.

This works! Thank you!!!