I put this at the beginning of a script I was trou...
# suitescript
k
I put this at the beginning of a script I was troubleshooting for a similar problem once. The record ID is empty if it's running during create, and populated if it's running during edit.