We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Get user email id in catalog scripts

Khanna Ji
Tera Guru

how can I get the email id of user in client scripts? I have checked g_user object but there is no method in it

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

An alternative would be to use the below in the default value column of variable definition.



javascript: gs.getUser().getEmail();


View solution in original post

4 REPLIES 4

Kalaiarasan Pus
Giga Sage

I don't think g_user holds email ID of the user.



But you can use g_user.userID to get the sys id of the current user and query the sys_user table and get it.


Can you give me an example of this?



Let me ask you in another way.



I have form X and form Y. On form load of form X, I should get few column values of form Y. How?


Kalaiarasan Pus
Giga Sage

An alternative would be to use the below in the default value column of variable definition.



javascript: gs.getUser().getEmail();


gs cannot be used in client scripts;

must create a script include and use that in client scripts