Populate Employee details based on Employee id

Rekha Tiwari
Kilo Guru

Hi All,

I have a custom table. In which I have created a field called Employee name which is referring to sys_user table and from user table I have called other fields using dot walk as Employee Number, Country, LOcation which is auto populating from user profile

 find_real_file.png

But now client want user should enter employee id then other fields should be auto populated. I have written below BR on that custom table (sn_hr_core_id):

(function executeRule(current, previous /*null when async*/) {

// Add your code here
var gr = new GlideRecord("sys_user");
gr.addQuery('employee_number' , current.u_employee_name.employee_number);
gr.query();
while(gr.next()){
gs.addInfoMessage("1");
current.u_employee_name = gr.name.toString();
current.update();
}

})(current, previous);

but not working. Any suggestion please?

15 REPLIES 15

HI,

Tried with your code but not populating correct user.