Can we use gs.now() in global & scoped applications??

Nagesh5
Tera Contributor

Hello Community,

Can anyone let us know can gs.now() will work scoped applications?

Thanks,

Nagesh

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

No it will not work in scoped applications.

The best way to use in scoped applications is using new GlideDateTime();

View solution in original post

4 REPLIES 4

OlaN
Giga Sage
Giga Sage

Hi,

Just checked on Developer site, no, it's not supported in scoped applications.

You can easily try something like this yourself by running the method in Scripts Background, 
and just switch to a scoped application.
By just running
var test = gs.now();
You will get the following output.

Evaluator.evaluateString() problem: 
com.glide.script.fencing.MethodNotAllowedException: 
Function now is not allowed in scope x_xyz_scopename. 
Use GlideDate instead: new GlideDate().getDisplayValue(): 
com.glide.script.fencing.ScopedScriptableObject.checkWhitelistAccess(ScopedScriptableObject.java:137)

Chandu Telu
Tera Guru
Tera Guru

Hi,

 

As @OlaN said gs.now() won't work in Scoped Application

 

You can use the - new GlideDateTime().getDisplayValue();

 

Thanks
Chandu Telu
Please Mark ✅ Correct/helpful, if applicable,

asifnoor
Kilo Patron

No it will not work in scoped applications.

The best way to use in scoped applications is using new GlideDateTime();