
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-07-2019 08:54 AM
I was wondering how many user records in my instance did not have a corresponding HR Profile record created. I couldn't seem to find this elsewhere on the community, so I figured I'd share.
Running a fix script similar to what is written below should print out an info level log message for each User sys_id which does not have a corresponding HR Profile record (yet).
var userGR = new GlideRecord('sys_user');
//userGR.setLimit(100);
userGR.query();
var missingHR = [];
var userIDs = [];
while(userGR.next()){
var hasProfile = new sn_hr_core.hr_Profile(userGR, gs).userHasProfile(userGR.sys_id);
if(hasProfile){
userIDs.push(userGR.getValue('sys_id'));
} else {
missingHR.push(userGR.getValue('sys_id'));
}
}
//gs.info('KMB: userID ' + userIDs[0]);
for(var i = 0; i < missingHR.length; i++){
gs.info('KMB: missingHR ' + missingHR[i]);
}
*this works in the following version
Build name: London
Build date: 12-20-2018_1717
Build tag: glide-london-06-27-2018__patch4-hotfix2-12-20-2018
- 1,889 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Is there a script for us to generate the hr profile for those users after this?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
You can also create a report of Users with No HR profile instead of running a script and put it on your dashboard. Here's a screenshot from my report:
Source type: Table
Table: User [sys_user]
This will then show all Users with no HR Profile. Hope this helps.