Populate Employee details based on Employee id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 11:12 PM
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
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 11:50 PM
Hi,
Please inform them that this is not best practice and is not recommended
If they wish to enter employee ID manually and want other fields to be auto-populated then it makes no sense in keeping that field as dot walked and it should be standalone field
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 04:04 AM
Hi
Basically we have a Record producer which is having fields like-
These values we are storing in custom (sn_hr_core_id) table. This table data we manually need to send in workday and from workday we need to upload data in servicenow. So workday has provided all fields value but not employee name as employee can be multiple. So they provided Employee id and other custom field value that filled from portal variables.
So I need help how can I load data using transform map. I did mapping but when run transform map, it employee id did not map to employee number hence all below information is empty:
Can you please suggest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 05:03 AM
how is your mapping is done?
Why are you setting the dot walked field in field map?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 09:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 08:08 PM
I doubt if it would work for dot walked field since value of it is derived from the parent field
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader