Fast formulas drive much of Oracle Fusion Absence Management: they validate leave entries, decide when workers enroll in plans, and calculate accruals, entitlements , ceilings etc. When one of them returns an unexpected result, you need a way to see what happened inside it.
This post explains , how to trace each of them. For any formula type not covered here, debug by passing the values you want to inspect into the RETURN variables of that formula type and checking them iteratively.
Quick reference
Use this table to find which ESS job produces the log for the formula you are debugging.
| Fast formula type | How to trace it | ESS job to run |
|---|---|---|
| Fast formulas for Absence Type | Method 1 (Return Variables) or Method 2 (log) | Evaluate Absences |
| Fast Formulas for Qualification plan | Method 2 (log) | Evaluate Absences |
| Global Absence Plan Enrollment Start / End or Global Absence Plan Duration | Method 2 (log) | Update Accrual Plan Enrollments |
| Fast Formula for Accrual plan/Compensation Plan/Donation Plan | Method 2 (log) | Calculate Accruals and Balances |
Fast formulas for Absence Type
Lets take the example of “Global Absence Entry Validation formula”. There are two ways to debug this formula:
- Method 1: Display the debug text in the validation error message while applying for the leave record.
- Method 2: Write the debug text to the log with
ESS_LOG_WRITEinside the formula. Add a leave record for a user, then run the Evaluate Absences process.
The sample formula below demonstrates both methods. Define and compile the fast formula, then add it to the absence type.
/******************************************************************************************
FORMULA NAME : XX_CASUAL_LEAVE_VALIDATION
FORMULA TYPE : Global Absence Entry Validation
DESCRIPTION : This formula validates the absence entry
Change History:
------------------------------------------------------------------------------------------
Name Date Version Comments
------------------------------------------------------------------------------------------
***************************************************************************************** */
DEFAULT FOR ANC_ABS_TYP_NAME IS ' '
DEFAULT for ANC_ABS_ENTRS_ABSENCE_TYPE_ID is 0
DEFAULT FOR ANC_ABS_ENTRS_DURATION IS 0
DEFAULT FOR ANC_ABS_ENTRS_ABSENCE_STATUS_CD IS ' '
DEFAULT FOR ANC_ABS_ENTRS_APPROVAL_STATUS_CD IS ' '
DEFAULT FOR l_msg IS ' '
DEFAULT FOR ERROR_MESSAGE IS ' '
INPUTS ARE IV_START_DATE (Date),
IV_END_DATE (Date),
IV_TOTALDURATION (Number)
VALID ='Y'
L_LOG = ESS_LOG_WRITE('INSIDE - XX_CASUAL_LEAVE_VALIDATION Formula')
L_LOG = ESS_LOG_WRITE('(XX_CASUAL_LEAVE_VALIDATION) ,'|| 'Step 1')
IF ANC_ABS_TYP_NAME = 'XX Casual Leave' THEN
(
L_LOG = ESS_LOG_WRITE('(XX_CASUAL_LEAVE_VALIDATION) ,'||ANC_ABS_TYP_NAME )
VALID = 'N'
ERROR_CODE = 'E'
ERROR_MESSAGE = 'Absence Type: '||ANC_ABS_TYP_NAME ||',IV_START_DATE: '||to_char(IV_START_DATE)||',IV_END_DATE: '||to_char(IV_END_DATE)|| ',IV_TOTALDURATION: '||to_char(IV_TOTALDURATION)
)
L_LOG = ESS_LOG_WRITE('EXIT - XX_CASUAL_LEAVE_VALIDATION Formula')
RETURN VALID, ERROR_CODE, ERROR_MESSAGE
What the sample does
- Writes log entries when the formula starts and exits (Method 2).
- Checks whether the absence type is XX Casual Leave.
- For that type, sets
VALIDtoNandERROR_CODEtoE, and buildsERROR_MESSAGEfrom the absence type name, start date, end date and total duration. Include the values which you want to debug. This text appears on screen when you submit the leave (Method 1). - Returns
VALID,ERROR_CODEandERROR_MESSAGE.
VALID to N, it blocks the leave request. Use this approach in a test environment and remove the debug logic before moving the formula to production.Output
Fast Formula for Qualification plan
These formula types support tracing:
- Global Absence Plan Duration
- Global Absence Band Entitlement
- Global Absence Plan Entitlement
- Global Absence Plan Roll Backward End
- Global Absence Plan Roll Forward Start
- Global Absence Plan Use Rate
Fast Formulas generic across Plans
These formula types work with any absence plan type:
- Global Absence Plan Enrollment Start
- Global Absence Plan Enrollment End
Sample fast formula
This Global Absence Plan Enrollment Start formula writes a log entry at the start and end, so you can confirm that it ran for the person and plan you are testing.
/******************************************************************************************
FORMULA NAME: XX_ENROLLMENT_ST_DATE
FORMULA TYPE: Global Absence Plan Enrollment Start
DESCRIPTION: This formula returns the Enrollment Start Date for absence plan enrollments
Change History:
Name Date Version Comments
------------------------------------------------------------------------------------------
***************************************************************************************** */
DEFAULT FOR PER_PERSON_ENTERPRISE_HIRE_DATE IS '0001/01/01 00:00:00' (date)
DEFAULT FOR ACP_HIRE_DATE IS '0001/01/01 00:00:00' (date)
DEFAULT FOR PER_REL_ORIGINAL_DATE_OF_HIRE IS '0001/01/01 00:00:00' (date)
DEFAULT for enrollmentStartDate is '2022/01/01 00:00:00' (date)
L_LOG = ESS_LOG_WRITE('(XX_ENROLLMENT_ST_DATE): '||'Start of Formula')
L_Hire_Date = Greatest (PER_REL_ORIGINAL_DATE_OF_HIRE, PER_PERSON_ENTERPRISE_HIRE_DATE, ACP_HIRE_DATE)
IF ( L_Hire_Date >= '2022/01/01 00:00:00' (date) ) THEN
(
enrollmentStartDate = L_Hire_Date
)
L_LOG = ESS_LOG_WRITE('(XX_ENROLLMENT_ST_DATE): '||'End of Formula')
RETURN enrollmentStartDate
ESS job
Log file
Fast Formula for Accrual plan/Compensation Plan/Donation Plan
These formula types support tracing:
- Global Absence Accrual Event
- Global Absence Accrual Matrix Formula
- Global Absences Annual Accrual Limit
- Global Absences Annual Accrual Limit Proration
- Global Absence Carryover
- Global Absence Carryover Proration
- Global Absence Ceiling
- Global Absence Ceiling Proration
- Global Absence Vesting Period
- Global Absence Transfer
- Global Absence Rollover
- Global Absence Proration
- Global Absence Plan Period Anniversary Event Date
Tips for effective tracing
- Always select Include trace statements in audit log when you submit the ESS job. Without it, your
ESS_LOG_WRITEoutput will not appear in the log. - Start every log message with the formula name, for example
(XX_ENROLLMENT_ST_DATE):, so you can find your lines quickly in a long log. - Log when the formula starts and ends. If the start line is missing, the formula never ran for that record.
- Convert dates and numbers with
to_charbefore concatenating them into a log message. - Narrow the ESS job parameters (person, absence type or plan) so the log only contains the records you are testing.
- For formula types that cannot be traced directly, return the value you want to inspect through the RETURN variable and verify it iteratively.
- Remove or reduce debug statements before promoting formulas to production.
With these techniques you can trace most absence fast formulas end to end and find the cause of unexpected results quickly.