Restricting Absence Entry to Today’s Date Using Fast Formula in Oracle HCM

Business Requirement:

  • The client requested that employees should not be able to apply for a specific absence type for any future date.
  • Absences should be restricted to today's date only.

Solution Implemented:

  • A Global Absence Entry Validation Fast Formula was developed to validate the absence start date.
  • If the start date > current system date, the system displays an error message and prevents submission.

 

/****************************************************************************** 
FORMULA NAME: ABC Formula  
FORMULA TYPE: Global Absence Entry Validation  
DESCRIPTION: This formula validates the absence type
*******************************************************************************/

DEFAULT FOR IV_START_DATE is '0001/01/01 00:00:00' (Date)

INPUTS ARE IV_START_DATE (Date)

L_SYSDATE = '4712/12/31 00:00:00' (Date)

l_start_date = to_date(to_char(IV_START_DATE, 'YYYY/MM/DD'), 'YYYY/MM/DD')

L_SYSDATE = GET_CURRENT_DATE()

VALID = 'Y'
ERROR_MESSAGE = ' '

IF (l_start_date > L_SYSDATE) THEN
(
  VALID = 'N'
  error_message = 'Start date cannot be in the future. sysdate = ' 
                  || to_char(l_sysdate, 'yyyy/mm/dd HH24:MI:SS') 
                  || ' start date = ' || to_char(iv_start_date, 'yyyy/mm/dd HH24:MI:SS')
)

RETURN VALID, ERROR_MESSAGE

 

Outcome:

  • When an employee attempts to submit a future-dated absence request, the system blocks the submission and provides a clear error message.
  • This ensures compliance with the business rule requiring same-day absence entry only for that specific absence type.

I hope this blog post was helpful for you. If you have any questions or feedback, please leave a comment below.