It sounds like in the UI the transaction number is...
# suitescript
m
It sounds like in the UI the transaction number is generated before your script runs, so your script can append to it