Skip to content

Commit 03c8e7b

Browse files
Probation HR Case for Employee (#2158)
* Create README.md * Update README.md * Probation.js
1 parent 07596f3 commit 03c8e7b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//This schedule job will Execute daily
2+
var hrProf = new GlideRecord('sn_hr_core_profile');
3+
hrProf.addQuery('user.active', true);
4+
var diff = [];
5+
hrProf.query();
6+
while (hrProf.next()) {
7+
var start = new GlideDateTime(hrProf.probation_date);
8+
var currentDate = new GlideDateTime();
9+
var gdt2 = new GlideDateTime(currentDate.getDisplayValue());
10+
diff = GlideDateTime.subtract(gdt2, start);
11+
var res = diff.getDisplayValue().toString();
12+
var days = res.substring(0, 2);
13+
var datediff = diff.getNumericValue();
14+
var dateDifferenceInDays = Math.floor(datediff / (1000 * 60 * 60 * 24));
15+
if (dateDifferenceInDays == "30") {
16+
var hrCase = new GlideRecord("sn_hr_le_case");
17+
hrCase.initialize();
18+
hrCase.hr_service = gs.getProperty("Probation HR Service"); //Probation HR Service
19+
hrCase.opened_for = hrProf.user.manager; // Manager of the user
20+
hrCase.subject_person = hrProf.user;
21+
hrCase.opened_by = hrProf.user.manager;
22+
hrCase.state = '10';
23+
hrCase.short_description = "Probation HR Case for " + hrProf.user.getDisplayValue();
24+
hrCase.insert();
25+
26+
}
27+
}
28+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#contribution 2
2+
I want to create Probation HR case for employees after 30 days of probation end date, means difference b/w current date & Probation end date should be 30 days in Schedule wise.This schedule job will be Executed daily basis. Here, HR case will create for active employee.Probation date field is available in HR Profile.
3+
HR case will store HR Service, state,subject person,short description, Opened by,Opened for etc.

0 commit comments

Comments
 (0)