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.

g_user_date_format in workspace

Edvin-Karalius
Tera Guru

Hey,
I'm using g_user_date_format variable in client scripts to get current user date formats and then parse them into something that is manageable.

But this variable does not exist in workspaces... (as usual...).
Anyone know an equivalent for this that can be used in workspaces?

Also... this wouldn't be a problem if SN just let us fetch the actual field values for dates... instead of getting the display values... super annoying.

1 ACCEPTED SOLUTION

GlideAjax won't work because the value on the server will not reflect the current client side date value unless you save first... and if i do save it, i might as well then use a BR for this.

Unless you mean getting the user date format from server.
And yeah, I'm not gonna do that either, just add to complexity for no reason.
Also might be still some problems there are still a few methods used that I haven't checked that are probably not supported on workspace either...
Like:

getDateFromFormat()
new Intl.DateTimeFormat()


So might as well make is less UX friendly and go with a BR for this.
I just want to be able to get the current client date in a standard format...
But SN devs have made it very difficult for no reason...

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Edvin-Karalius 

yes it's not supported.

you will have to rely on GlideAjax to get that format.

what's your actual business requirement?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

GlideAjax won't work because the value on the server will not reflect the current client side date value unless you save first... and if i do save it, i might as well then use a BR for this.

Unless you mean getting the user date format from server.
And yeah, I'm not gonna do that either, just add to complexity for no reason.
Also might be still some problems there are still a few methods used that I haven't checked that are probably not supported on workspace either...
Like:

getDateFromFormat()
new Intl.DateTimeFormat()


So might as well make is less UX friendly and go with a BR for this.
I just want to be able to get the current client date in a standard format...
But SN devs have made it very difficult for no reason...

@Edvin-Karalius 

yes there are lot of client side functions which are not supported in workspace.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader