The CreatorCon Call for Content is officially open! Get started here.

workspace in servicenow

shrngikaG
Tera Contributor

how to populate loggedin user name in servicenow workspace.

don't have any idea about workspace.

1 ACCEPTED SOLUTION

Sarthak Kashyap
Tera Expert

Hi @shrngikaG ,

I tried your problem in my PDI and it works for me please check below solution 

1. Create client script and add below code 

function handler({
    api,
    event,
    helpers,
    imports
}) {
    var name = api.context.session.user.fullName;
    api.setState('loggedInuser', name);
}

SarthakKashyap_0-1735624662268.png

 

2. Create client state parameter 

SarthakKashyap_1-1735624729627.png

 

3. Add this client state parameter to stylized text or where ever you want to show the current user name 

SarthakKashyap_2-1735624832127.png

 

Result 

SarthakKashyap_3-1735624863086.png

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

 

View solution in original post

5 REPLIES 5

sarthakkash
Kilo Guru

Hi @shrngikaG ,

I tried your problem in my PDI and it works for me please check below solution 

1. Create client script and add below code 

function handler({
    api,
    event,
    helpers,
    imports
}) {
    var name = api.context.session.user.fullName;
    api.setState('loggedInuser', name);
}
sarthakkash_0-1735624967776.png

 

 

2. Create client state parameter 

sarthakkash_1-1735624967661.png

 

 

3. Add this client state parameter to stylized text or where ever you want to show the current user name 

sarthakkash_2-1735624967776.png

 

 

Result 

 

sarthakkash_3-1735624967677.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak