catalog client script to get logged in username, email address, phone

BanuMahalakshmi
Tera Contributor

Hi,

 

Pls assist me to create catalog client script to get logged in username, email address, phone.

 

Thanks.

7 REPLIES 7

SN_Learn
Kilo Patron
Kilo Patron

Hi @BanuMahalakshmi ,

 

Instead of catalog client script, you can use 'auto populate' feature

SN_Learn_0-1720289549851.png

 

Steps:

1. Create a variable of type 'request for' as below, this will have the current logged in user.

SN_Learn_0-1720290087848.png

 

2. Now, we will create other variables which will be dependent on the 'requested for' variable. Check the screenshots below:

SN_Learn_1-1720290262037.png

 

Click on 'Auto populate' section and select as below:

SN_Learn_2-1720290356905.png

 

 

 

Similarly, do it for 'Email':

 

SN_Learn_3-1720290442507.png

 

SN_Learn_4-1720290504273.png

 

 

The output will be as below:

SN_Learn_5-1720290563009.png

 

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Community Alums
Not applicable

I find this solution ideal as it introduces less technical debt when you don't have to manage script. Does this work when the requested for is changed on the form as opposed to on load?

Yes, It is dynamic and will work onChange as well.

 

I am logged in as 'system admin' and when I change the 'requested for' then also it will work:

SN_Learn_1-1720402400739.png

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Satishkumar B
Giga Sage
Giga Sage

Hi @BanuMahalakshmi 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0779000

———————————————-
Please consider marking my reply as Helpful👍 and/or Accept Solution, if applicable. Thanks!