How to check the current logged in user in servicenow using on load client script.

siddharth26
Tera Guru

How to check the current logged in user in servicenow using on load client script.

1 ACCEPTED SOLUTION

Have a look at the link I provided. It's literally mentioned there.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

5 REPLIES 5

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This might help you:
https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_scripting_newyork_t...

Is about the g_user class for Client Side Scripting.

For example you've got g_user.userID available.

What are you exactly after? Can you explain a bit? 

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

siddharth26
Tera Guru

Hi,

 

Thanks for the response i want to see the logged in user name should be displayed in form ,when the form is loaded.

 

Thanks

 

Have a look at the link I provided. It's literally mentioned there.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Aniket Sawant
Mega Expert

Hi,

please try this.

function onLoad() {

g_form.setValue('field name-on-form',g_user.userName );

}

Please mark correct or helpful based on the impact.

Regards,

Aniket Sawant.