Script to run before the view is created.

HI, thanks.
I have a special requirement.
We created a custom module from opportunities, named bookings and a MasterData Module to keep record for the booking id, this number must increment for any new booking record, which it does for now.
But what I need, is that this number appears when creating a new record.
I already tried on creating a script in js, on creating the view, (extendsFrom: 'CreateView') but it seems it runs globally every time a view is created, it's very sensitive a minimal error will block the whole instance. I feel sorry everytime we required sugar support to helps us initialize the instance again.
I was wondering if there's a better place to implement this script, a logic hook or something like that, 
Thanks again.