HR Life cycle event activity set advanced trigger

SaiVikasR
Giga Contributor

Hi All,

I am using advanced script to check if last day of is today is true trigger activity set. I have checked script with adding logs I am unable to get last day of work, I can see parent HR case.  Last day of work updated with todays date.

 var termReason = String(parentCase.getValue('u_reason_for_termination')).toLowerCase();
    if (termReason == 'attend') {
        return false;
    }
    // Immediate termination check
    var isImmediate = (parentCase.u_immediate_termination == true || parentCase.u_immediate_termination == 'true');
    // Last day logic
    var isLastDay = false;
    var lastDayRawValue = parentCase.getValue('u_lastdayofwork');
    if (lastDayRawValue) {
        var today = new GlideDate();
        var lastDay = new GlideDate();
        lastDay.setValue(lastDayRawValue);
        // >= 0 means today OR past
        if (today.compareTo(lastDay) >= 0) {
            isLastDay = true;
        }
    }

    return (isImmediate || isLastDay);
0 REPLIES 0