how to auto populate email id in catalogue form at on load form

Suresh36
Tera Expert

how to auto populate email address in catalogue form. on load form

please help me on this.

 

1 ACCEPTED SOLUTION

Hello,

Open catalog item form, go to Email variable and add syntax I gave you in default value tab like below

find_real_file.png

Once you do , email will be auto populated, see below

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

9 REPLIES 9

Harish KM
Kilo Patron
Kilo Patron
Hi you can do like this write a client script and script include . Your client script should be onchange and select variablename where you will select user Onchange Catalog client script; function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } var ga = new GlideAjax('userDetails'); // script incude name ga.addParam('sysparm_name','getEmail'); // function name ga.addParam('sysparam_id',newValue); ga.getXML(Process); } function Process(response) { var answer = response.responseXML.documentElement.getAttribute("answer"); alert(answer); g_form.setValue("variablename",answer); } Script include: getEmail: function() { var gr=new GlideRecord("sys_user"); gr.addQuery("sys_id",this.getParameter('sysparam_id')); gr.query(); if(gr.next()) { return gr.user.email; }
Regards
Harish

we need the form loading (on load form) at that time email address should be displayed

Hello,

Write this in email address variable dictionary

javascript: gs.getUser().getEmail()

Keep this below link handy

https://servicenowguru.com/scripting/user-object-cheat-sheet/

Mark my answer as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hi 

im unable to find the variable dictionary.

this is a catalogue form variable

can you tell me , clear steps