How would you use this global serial number? Why would you need it?
You can set up table for this purpose and create a new record in it each time you need a new number--copying the value to the field in the data table where you need it.
Using a script to increment serial numbers can be problematic in multi-user systems where two users performing the same script at the same time can get identical values. The auto-entered serial avoids that issue.