How to auto populate the name and email of the current user in service catalog using the catalog client scripts

Mohan6
Tera Contributor

How to auto populate the name and email of the current user in service catalog using the catalog client scripts 

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You might consider using the default value of the variables. Or perhaps Catalog Data Lookup Definition. Don't see a reason for Catalog Client Script here. 

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

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

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

Robbie
Kilo Patron
Kilo Patron

Hi Mohan,

I answered a very similar question just the other day. See below link.

Rather than call client scripts such, set the default values for each field by configuring the variable (Right client and set the default value for each field/variable)

For the email field, set the default value to: javascript: gs.getUser().getEmail();

For the name field, set the default value to: javascript: gs.getUserID()

These will work on both the catalog native view and the Service Portal.

Please mark correct and/or helpful.

Thanks,

Robbie

Similar question: https://community.servicenow.com/community?id=community_question&sys_id=78efc5b4db318910dd886c8e1396194f

Robbie
Kilo Patron
Kilo Patron

Hi Mohan,

 

Just circling back on this. Did you see my response?

So as to help others, please mark correct and/or helpful.

Thanks,

Robbie