on a new record, use the "Xrm.Page.data.entity.getId();"to get the value, which is blank...
then save the record. try calling that line again (from an onchange field event) to see if the record is new or existing. the value is still empty. obviously if yourefresh (F5) or close and retrieve the record, it works fine.
Since the onLoad method doesn't fire after a save, we need a reliable way to know that the record has been saved in the database as we have plugins that fill certain fields with values and we don't want to have to tie the fields/handler on the form for each entity.