HR Cases displaying record not found and cannot be deleted


Description

The following KB provides information on how to resolve an issue in HR when a user/admin views a record and is provided with the 'record not found' message.

Release or Environment

All

Cause

It is possible that the HR case record has a corrupt sys_class_name.

For example:

Record in sn_hr_core_case_talent_management (HR Talent Management Case). If for some reason the sys_class_name is changed the record will not be viewable from a list view but can still be seen from the database. This results in an orphan record.

Resolution

Since the class name is corrupted, the user or admin can run the a simple script to alter the sys_class_name of the record which would then insert a new record into a respective table that would make the record viewable which can then be successfully removed.

var gr = new GlideRecord(‘tablename’);
gr.addEncodedQuery(‘you_query_for_the_corrupted_record’);
gr.query();
var count = gr.getRowCount();
if (count > 0) {
while (gr.next()) {

//gr.sys_class_name = ‘new_target_class’;
//gr.update();

}
gs.print(count);
}

The script will query the table for the corrupted record. Once it finds the record the sys_class_name of the
record will be updated to a new sys_class_name value. This inserts a brand new record into the class specified which will
now make the record visible and eligible for removal.