In NAV 2013 R2, if a RecordRef does not have a active record, CURRENTKEYINDEX will return -1. IN NAV2009 and older, the value was 1 (As the number of the primary key).
If the value of CURRENTKEYINDEX is given to KEYINDEX – a index out of bounds error will occur.
This is not documented in the NAV 2013 R2 help.
In NAV2009 and earlier, GLOBALLANGUAGE(0) would set the language in NAV to the “default” language of the classic client.
This undocumented feature does not work in NAV 2013 anymore. It will return an error saying:
Exception of type
NavNotSupportedLanguageException' was thrown.
So you must instead set the language ID to the correct value. Use codeunit 43 for this.