Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Priya Shekar
Giga 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

The SN Nerd
Giga Sage
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