Hey folks, has anyone had the issue where your com...
# suitescript
n
Hey folks, has anyone had the issue where your company timezone settings affect what timezone a datetime field is shown as through a RESTlet? Wherever I read people state that the USER settings of the user getting the data (in this case a dedicated integration user) is what affects the timezone shown, but we’ve tested back and forth and the only thing changing it in this case are the company settings… we can see in most cases it is the user setting, in example in the UI etc, but thorugh the RESTlet we’re testing in we just get the company timezone.. FYI this is restlet that through a search in the scripts pulls out the datetime field. Edit: I guess my question is if this can be overridden somehow? Like forced to be taken from the integration user in our case?
b
what timezone are you getting from
Copy code
runtime.getCurrentUser().getPreference({
  name: "timezone",
});
n
I got: “Europe/Amsterdam” then I changed the company setting to GMT and ran it again and then got: “Europe/London” Meaning as I thought the company settings are being used.. ain’t that strange? @battk
b
Sounds strange, whats the actual user timezone selected by the user
if the user never selected any, then the user may simply be using the company default
n
I wish, the user is set to GMT and changing the user doesn’t change the output 😩
b
mystery
i would try using the internal url while logged into your integration user
if that works, i would generate a new token and give that one a try
declare the old ones cursed
n
@battk internal URL of the RL? So you mean call it from the browser while logged in?
b
yes
you can do more using client side js, but its probably much easier using the address bar to do a get
n
True, let me try
@battk ok so this is just getting crazier 😄 .. Steps I’ve done and the result it gives me: * TZ User: GMT, TZ Company: Amsterdam (GMT+1):  - Search date in UI: 2021-01-28 075823  - Search date in Postman (through RESTlet): 2021-01-28 085823  - Search date in browser through GET: 2021-01-27 102459 * TZ User: GMT, TZ Company: GMT:  - Search date in UI: 2021-01-28 075823  - Search date in Postman (through RESTlet): 2021-01-27 102459  - Search date in browser through GET: 2021-01-27 102459
I don’t know why I get the 2021-01-27 date….. and especially why I get it in Postman too after changing the company TZ to GMT… can you make any sense out of this behaviour?
Btw the User i use in the UI and Postman is currently the same (the integration user)
b
still looks mysterious
what does your code look like
n
@battk I think I found it.. as usual it’s not NS fault but my own stupidity 🙂 ….. the email that was used for the user was used for 2 users, both integrations users with the same role and email, I was logged in to the wrong one the whole time while changing the settings…… the correct one actually had GMT+1 set the whole time hence that timezone being used… I’m gonna verify it a bit later but I think that’s it.. thanks for wasting time on this with me 😄