Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

how to get current logged in user and date and time in service now

divyareddyp2
Giga Contributor
 
4 REPLIES 4

glideFather
Tera Patron

Hi @divyareddyp2,

 

please provide more details.

 

Because it will depend on location where you want to get it...

 

For example currently logged in user:

  • in portal (frontend) > g_user.userName;
    • e.g. catalog client script
  • in backend (backend) > gs.getUserID();
    • e.g. business rule

And for the date and time, please refer to GlideDateTime, GlideDateTime - Global or Glide Server APIs

 

Thank you for accepting my solution.


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

Hi @divyareddyp2,

 

do you have any details? Please review my response above.


✂-----Cutting-out-the---✦AI-noise✦---All-replies-written-and-vouched-for-by-GlideFather---

Nikhil Bajaj9
Tera Sage

Hi @divyareddyp2 ,

 

Can you specify where you want to pick these value - On form (Client), In any Business Rule , Scriopt include (Server side). As current logged in user in client script can be found using g_user class's method while on backend you can use Glide system class's Methods.

 

Please appreciate my efforts, help and support extended to you by clicking on – “Accept as Solution”; button under my answer. It will motivate me to help others as well.
Regards,
Nikhil Bajaj

ServiceNow Rising Star-2025

Ankur Bawiskar
Tera Patron

@divyareddyp2 

where you want -> client or server side?

what's your business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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