Referencing the sys_user email address

Jason Stephens
Kilo Guru

How would I create a reference variable that is referencing the email address from the sys_user field?

17 REPLIES 17

ck_phenix
Kilo Expert

Hi All,



Three ways possible here:


  • Add the attributes for the reference field like below which will show only email address in the auto-complete feature. However, still the display value will be the Name of the user.
ref_auto_completer=AJAXTableCompleter,ref_ac_display_value=false,ref_ac_columns=email;
  • Personalize the Form layout and bring the Caller.Email field to the form. (Not possible for catalog variables)
  • Write an onChange client script or catalog client script(for catalog variables) to set the Email field with User's email based on Caller.


Thanks,
CK



Thanks CK.



I just wonder how do I bring the Caller.Email field to the form?


I know there is an email field in the sys_user table, however, that's not available on the incident form layout.


Hence, I created the custom email field (u_email) on the form. Is it a best way to have the email field?



Many thanks



Eddie


Hi Eddie,



Check this link Personalizing Forms - ServiceNow Wiki and select the Caller field and click on Add icon (highlighted in the Screenshot below) to display the sys_user table fields. Then select the Email field to add it to the viewable slushbukcet and save it. You would be able to see the field in the Form layout.



Step1.png



Thanks,


CK


Hi Eddie,



Yes, this is the best way to have the Email field in the Form layout (Make it readonly if you wish user should not modify it). You might have to delete the custom field u_email created.



Thanks,


CK


Eddie if you want to be able to change it every time, without changing the actual user record the best bet is to add a string field called email and use the client I posted above