Just found out `runtime.envType` in a development ...
# suitescript
m
Just found out
runtime.envType
in a development account returns
PRODUCTION
😱. Anyone know the best practice to determine if a script is running in a development environment?
c
I set a flag on the script deployment record because I don't trust what's returned from the API
Ideally you wouldn't need to know if you're in prod or not except for testing purposes and even then you need to be careful.
m
thanks Craig! I think I'm going to try to compare accountId since that differs between development and production
m
I think development accounts are technically production type accounts. There is no -SB suffix either
m
Yeah that really tripped me up since I just moved my company's staging integration from sandbox to a development account! It was trying to send data to our production app facepalm
m
Been there before unfortunately
b
beware the other way around after its moved to production
refreshed sandbox gets production configuration
m
Yup, after that happened I added a script parameter for environment and script terminates if it doesn't match
m
Yeah now I'm checking against both runtime.envtype and runtime.accountId
m
Just accountId should be enough though?
m
I wasn't sure off the top of my head what accountid is returned in sandbox (if it includes the _sb suffix so figured safe than sorry)
m
I can confirm it includes the SB suffix
🙇‍♂️ 1
👍 1