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

Auto Populate user's email on catalog item field

pathumh09586800
Mega Contributor

I’m creating a Service Catalog item and I have a variable to capture the requester’s email. How can I automatically populate this variable with the logged-in user’s email when the form loads?

19 REPLIES 19

@pathumh09586800 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I used this, It works, Thank you so much

 

@pathumh09586800 

Glad to know that my approach worked for you.

Please mark my response as correct and close the thread.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

TejasLogicX_11
Mega Contributor

Hi @pathumh09586800  ,

try this 

function onLoad() {
  // Set the variable with the logged-in user’s sys_id
  g_form.setValue('requester_email', g_user.userID);
}

yes, I used this, it works, thank you so much, this is helpfull