diff --git a/Server-Side Components/Scheduled Jobs/Employee Probation case/Probation.js b/Server-Side Components/Scheduled Jobs/Employee Probation case/Probation.js new file mode 100644 index 0000000000..b952fa1647 --- /dev/null +++ b/Server-Side Components/Scheduled Jobs/Employee Probation case/Probation.js @@ -0,0 +1,28 @@ +//This schedule job will Execute daily +var hrProf = new GlideRecord('sn_hr_core_profile'); +hrProf.addQuery('user.active', true); +var diff = []; +hrProf.query(); +while (hrProf.next()) { + var start = new GlideDateTime(hrProf.probation_date); + var currentDate = new GlideDateTime(); + var gdt2 = new GlideDateTime(currentDate.getDisplayValue()); + diff = GlideDateTime.subtract(gdt2, start); + var res = diff.getDisplayValue().toString(); + var days = res.substring(0, 2); + var datediff = diff.getNumericValue(); + var dateDifferenceInDays = Math.floor(datediff / (1000 * 60 * 60 * 24)); + if (dateDifferenceInDays == "30") { + var hrCase = new GlideRecord("sn_hr_le_case"); + hrCase.initialize(); + hrCase.hr_service = gs.getProperty("Probation HR Service"); //Probation HR Service + hrCase.opened_for = hrProf.user.manager; // Manager of the user + hrCase.subject_person = hrProf.user; + hrCase.opened_by = hrProf.user.manager; + hrCase.state = '10'; + hrCase.short_description = "Probation HR Case for " + hrProf.user.getDisplayValue(); + hrCase.insert(); + + } +} + diff --git a/Server-Side Components/Scheduled Jobs/Employee Probation case/README.md b/Server-Side Components/Scheduled Jobs/Employee Probation case/README.md new file mode 100644 index 0000000000..b9a4e3a6c4 --- /dev/null +++ b/Server-Side Components/Scheduled Jobs/Employee Probation case/README.md @@ -0,0 +1,3 @@ +#contribution 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. +HR case will store HR Service, state,subject person,short description, Opened by,Opened for etc.