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.

Gs object not working in client script

naziya
Giga Contributor

I am trying to use GS object in my client script but I am getting the error :-

'The object "gs" should not be used in client scripts'

How can I use gs in my script?

12 REPLIES 12

Cheat sheet helpful, thanks

Deepak Ingale1
Mega Sage

If you are working with form fields on client script, you should use g_form.


As said by Anurag Gs is server side object and works for BR


domaners
Kilo Guru

Hi Naziya. As previously mentioned, g_user and g_form can get you most of the details you need, but if you absolutely can only use gs, then you'd need to write a script include and pass the gs value back to the client via Glide Ajax call.



Use the examples on the following page to help you get it working:



GlideAjax - ServiceNow Wiki


naziya
Giga Contributor

Hi Adam.Thanks. I could not find on service-now wiki how or where to use gs but I think your answer will help.