You don't need a script for this, just an auto-entered calculation. You don't indicate what you mean by "less than expected" so you'll have to adjust the following example to fit your actual circumstances.
Define an auto-enter option for field 4 (assuming all fields are part of the same table here.)
If ( field3 < expectedValue ; "less" ; self ) /* self keeps value unchanged if field 3 is not less than expected */
clear the "Do not replace existing value" check box so that field will automatically update if field3's value changes.