Page 1 of 1

jscript example from work

Posted: Wed Jan 23, 2019 5:35 pm
by maechoi
// -------------------------------------------------------------------------
// -------------- OnSave -------------
// -------------------------------------------------------------------------
//Set the effective date = 30(the waiting period) days from date of hire, regardless of eligibility date
/*
Event.Engine.EffectiveDate = Event.Employee.DateOfHire.AddDays(Event.Config.WaitingPeriod);

if (Event.Employee && Event.Employee.EmployeeEvents)
{
for (var empEvent in Event.Employee.EmployeeEvents)
{
if (empEvent.Reason)
{
var EventReason = empEvent.Reason;
if (EventReason.Contains("from PRN FullTime to") || EventReason.Contains("from PRN to"))
{
Event.Debug("EE Event - Change effective date.");
var NewEffectiveDate = new DateTime(empEvent.EventDate.Year, empEvent.EventDate.Month, empEvent.EventDate.Day);
Event.Engine.EffectiveDate = NewEffectiveDate.AddDays(30);
}
}
}
}
//Event.Debug("Event.Engine.EffectiveDate: {0}", Event.Engine.EffectiveDate);
*/
// -------------------------------------------------------------------------
// -------------- OnLifeEvent -------------
// -------------------------------------------------------------------------
//OnLifeEvent JLP 07/17/2018
//If employee goes from Full time to Part time set correct Coverage Termination Date.
function CheckEligible(JobClass)
{
for (var i in JobClass)
{
if(Event.Employee.JobClass.Code == JobClass)
{
return true;
}
}
return false;
}

var jClass = new Array("Parttime-Ineligible");
if (Event.EventType == "JobClassChanged" && CheckEligible(jClass))
{
Event.Action.TerminationDate = Event.EventDate;
}