The Creating new records and Updating values of a recordset record recipes in Chapter 6, Basic Server-Side Development, mentioned that these operations did not call onchange methods automatically. Yet, in a number of cases, it is important that these operations are called, because they update important fields in the created or updated record. Of course, you can do the required computation yourself, but this is not always possible as the onchange method can be added or modified by a third-party addon module installed on the instance that you don't know about.
This recipe explains how to call the onchange methods on a record by manually playing the onchange method before creating a record.