I have a variable named email in catalog item. I want to set the value of this variable to current logged in user's email id as a default value. For this i am using " gs.getUser().getEmail()" in the default value field of email variable but it's not

mr_kamleshkumar
Kilo Contributor

I have a variable named email in catalog item. I want to set the value of this variable to current logged in user's email id as a default value. For this i am using " gs.getUser().getEmail()" in the default value field of email variable but it's not working. Can any one help me over this ?

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You're close, but the default value needs to be prepended with javascript: so



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


Would you know how to auto populate the email field with the value that's in the user field if the user is not the one currently logged in?

You'd probably need an onchange client script on your user variable that does a g_form.getReference() and then populates the email variable.