Wednesday 26 September 2018

Fusion HCM - Getting HR Data in Fast Formula

To get HR Data in Fast Formula,

1. The Formula Type must be Payroll Access to HR
2. U Must use Proper CHANGE_CONTEXTS to get required Data


Below is a Sample Payroll Access to HR Type Formula :

DEFAULT FOR PER_ASG_JOB_ID IS -1
DEFAULT FOR PER_JOB_ATTRIBUTE1 IS 'EXEMPT'

Inputs are hr_id (number),
           eff_date(date),
           mode (text)

l_hr_ass_id   = hr_id
l_eff_date = eff_date

X_OUTPUT    = '0001/01/01 00:00:00'  (DATE)
X_OUTPUT_NUMBER  = 0
X_OUTPUT_TEXT  = ' '

IF mode = 'JOB_NAME' THEN
(
   l_job_id=-1
   X_OUTPUT_TEXT='EXEMPT'
  
   CHANGE_CONTEXTS (HR_TERM_ID = l_hr_ass_id)
   (
    X_OUTPUT_TEXT  = GET_TABLE_VALUE('NON_MANAGEMENT_JOBS_MAPPING','JOB_MAPPING',PER_ASG_JOB_NAME,'0')
   )
  
)

ELSE IF mode = 'PER_JOB_ATTRIBUTE1' THEN
(
   l_job_id=-1
   X_OUTPUT_TEXT='EXEMPT'
  
   CHANGE_CONTEXTS (HR_TERM_ID = l_hr_ass_id)
   (
    l_job_id  = PER_ASG_JOB_ID
   )
  
   IF l_job_id <> -1 THEN
   (
   CHANGE_CONTEXTS (JOB_ID = l_job_id)
   (
    X_OUTPUT_TEXT  =  PER_JOB_ATTRIBUTE1
   )
   )
  
)

RETURN X_OUTPUT_TEXT, X_OUTPUT_NUMBER

No comments:

Post a Comment