Requirement :
Employee is allowed to apply for unpaid leave only when his/her Annual leave balance is 0(Zero).
STEP 1:
Create Fast Formula as Mentioned Below
--------------------------------------------------------------------------------------------------------------------
NAME : XX_GET_PLAN_BALANCE
TYPE : Global Absence Accrual
: Choose Your Legislation |
Formula Text :
/************* Retrieve the accrual balance in the formula *********************/
INPUTS ARE IV_PERSON_ID,IV_TERM_ID,IV_EFF_DT (DATE)
DEFAULT FOR IV_PERSON_ID IS 0
DEFAULT FOR IV_TERM_ID IS 0
DEFAULT FOR IV_EFF_DT IS '2014/01/01' (DATE)
L_Leave_Balance = 0
L_Accrual_Plan_ID = 300000001679015 /* Accrual Plan ID */
L_Term_Id = IV_TERM_ID
L_Person_Id = IV_PERSON_ID
L_Eff_Dt = IV_EFF_DT
CHANGE_CONTEXTS(ACCRUAL_PLAN_ID = L_Accrual_Plan_ID,
HR_ASSIGNMENT_ID = L_Term_Id,
PERSON_ID = L_Person_Id,
EFFECTIVE_DATE =L_Eff_Dt )
(
L_Leave_Balance = GET_ACCRUAL_BALANCE()
)
return L_Leave_Balance
/****************************************************************************/
---------------------------------------------------------------------------------------------------------------------
STEP 2:
Create Fast Formula as Mentioned Below
---------------------------------------------------------------------------------------------------------------------
NAME : XX_VALIDATION_FF
TYPE : Global Absence Entry Validation
: Choose Your Legislation
Formula Text :
/********************validation formula***********************/
INPUTS ARE IV_START_DATE(DATE),iv_end_date (date)
DEFAULT FOR IV_START_DATE IS '2014/01/01' (DATE)
DEFAULT FOR IV_END_DATE IS '4712/01/01' (DATE)
L_Acrl_Balance = 0
L_Person_Id = GET_CONTEXT(PERSON_ID,0)
L_Term_Id = GET_CONTEXT(HR_TERM_ID,0)
L_Eff_Dt = IV_START_DATE
L_occurence = 0
SET_INPUT('IV_PERSON_ID', L_Person_Id)
SET_INPUT('IV_TERM_ID', L_Term_Id)e
SET_INPUT('IV_EFF_DT', L_Eff_Dt)
EXECUTE('XX_GET_PLAN_BALANCE')
L_Acrl_Balance = GET_OUTPUT('L_Leave_Balance', 0)
IF (L_Acrl_Balance < 1) THEN
(
VALID = 'Y'
)
ELSE
(
VALID = 'N'
ERROR_MESSAGE = 'ERROR - Current Leave Balance: '+to_text(L_Acrl_Balance)+' You can take this type of leave only when your annual leave balance is 0(Zero) '
)
return VALID, ERROR_MESSAGE
/****************************************************************************/
---------------------------------------------------------------------------------------------------------------------
STEP 3:
Attach Validation formula at Absence Type.
---------------------------------------------------------------------------------------------------------------------
Absence Type > Select 'Validation Formula'
i.e.
As per the current requirement
Go to UNPAID leave > Select 'XX_VALIDATION_FF' formula as validation formula.
Navigation : Absence Administration > Absence Type > Search UNPAID Leave
NOTE:- Make sure Absence Type and Formulas must be fall under same Legislation.
---------------------------------------------------------------------------------------------------------------------
GREAT WORK!!! GREAT ARTICLE, really helped and i was able to do validation on my absence, just a couple of things to work on in my scenario is a bit different.
ReplyDeleteI need to check the total number of days from previously applied leaves + balance + currently applied leave to be less than eligible days to get from Accrual Matrix. So yeah, a little difference but surely gave me a good hint on how to work it out..THANKS A TON
Thank you for appreciation .. :)
DeleteHi Jigar,
ReplyDeleteCan you please let me know how can you get the absence plan ID ?
Hi,
DeleteYou can get it from OTBI. You need to write down query for the same.
Table : ANC_ABSENCE_PLANS_F
Dear Jigar
ReplyDeleteWhen I tried to compile it, system showed me an error on line 16 (SET_INPUT('IV_EFF_DT', L_Eff_Dt)
from second step. Do you know how I can fix it?
Thanks!
Hi
DeletePlease give me error details.
Dear Jigar, line 16 is EXECUTE('XX_GET_PLAN_BALANCE'), sorry. Thanks again.
ReplyDeleteDear Jigar, could you send both FF (get plan balance and Validation) via email. I need a complete and compiled one asap.
ReplyDeleteThanks a lot, Matias.
Hi Matias,
DeleteI am not sure how to get your email.
Good Blog thanks for sharing this informative article.
ReplyDeleteOracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
Oracle Fusion Financials Online Training
Hi Team ,
ReplyDeleteWe have one requirement, Actually we have configured our absence management system as an incremental basis, but here we want to allow the employee to apply the leave in future dates, but we don't want to allow the employee to apply the leave more than sysdate balance amount.
For Ex: If Employee "A" has the sick leave plan and leave balance is added into his account as a incremental basis .
every month 1 day is added into his account , mean 31/dec he will get 12 days as a balance.
In the month of Feb employee will 2 days balance .in the month of june we will have 6 days balance .
if employee apply the leave in the month of Feb with future dates like june 10th to some other date in June , here we want allow the employee to apply 2 days only not 6 days , because as for the sysdate( Feb Month) employee have only 2 days .
Hi Raghav,
DeleteIs it resolved ?? you can contact me on jigarm0312@gmail.com in case if you need any help.
Hi,
ReplyDeleteWe have a requirement where employee can apply 13 days in a month but not more than 60 days in year
Can anyone please help with this requirement
Hi Raghav,
DeleteIs it resolved ?? you can contact me on jigarm0312@gmail.com in case if you need any help.
Hi Jigar,
ReplyDeleteI was trying to Execute same Fast Formula for my absence, but I am getting accural Balance as Zero.
Not sure, what is the root cause..If you want, i can share my details to your email ID
Hi Vishwa
DeleteYou may be utilizing incorrect plan id.
Can you send me your formulas on my email so i can help you
Hi,
ReplyDeleteThanks for sharing, it was informative. We play a small role in upskilling people providing the latest tech courses. Join us to upgradeAPIGEE ONLINE TRAINING
Hi Jigar,
ReplyDeleteI was trying to Execute same Fast Formula for my absence, but I am getting accrual Balance as Zero.
Not sure, what is the issue. Please help.
Hi Sorry for delay
DeleteAre you still facing issue ??
please mail me your fast formula - jigarm0312@gmail.com
Thank you
ReplyDelete