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

divyareddyp2
Mega 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.

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hi @divyareddyp2,

 

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

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


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

Ankur Bawiskar
Tera Patron
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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader