In HR profile Same HRP number for 2 candidates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 10:34 PM
Hi All,
Can anyone please help me on this query.
In HR profile Same HRP number for 2 different candidates ,HRP number is unique for candidates
Need to increase the One HRP number to remove the duplicates.
Can you please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 11:13 PM
Hi @nikhitha24 ,
Although duplicate numbers are rare, numbering does not enforce uniqueness, by default.
- Create a before business rule on insert only to check for duplicate values and replace duplicates with the next available number.
- Enable a unique index on the table.
Sample business rule
This sample script can be used as part of a before business rule on insert only to check for duplicate numbers and replace them with the next available number. The following script references a script created in Configure left padding of a system number in a table.
var curNum = current.number + '';
if(curNum) {
var recordClass = current.getRecordClassName();
var now_GR = new GlideRecord(recordClass);
now_GR.addQuery('number', curNum);
now_GR.setLimit(1);
now_GR.query();
if(now_GR.getRowCount() > 0) {
var newNum = getNextObjNumberPadded();
gs.addInfoMessage("The number " + current.number + " was already used by another " +
recordClass + ". The " + recordClass + " number has been changed to " + newNum);
current.number = newNum;
}
}