We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to get logged in users time zone in scoped app?

Priya Shekar
Tera Guru

Hi All,

We used to get logged in users time zone by "gs.getUser().getTZ();"

But in scoped app, we get "Evaluator: org.mozilla.javascript.EcmaError: undefined is not a function." error while using the above code.

Is there any alternative for getTZ()?

Thanks,

Priya

10 REPLIES 10

paulmorris
Giga Sage

gs.getTimeZoneName();



Scoped GlideSystem API Reference - ServiceNow Wiki



A different mindset is required when writing Scoped Applications.


The API is quite different.



Recommend bookmarking below


List of Scoped Scriptable Objects - ServiceNow Wiki



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Hi Paul\Kalai,



Still getting the same Ecma error, when using the "gs.info(gs.getTimeZoneName());" which comes under the scoped API as you guys mentioned.



Thanks,


Priya


Can you verify if any other gs functions as working ? Like gs.getUserID()?


Yes other gs functions works as expected in scoped app except getTimeZoneName().


I think we have to raise this issue in HI portal..



Thanks,


Priya