Below is the Fast formula code
DEFAULT FOR CMP_IV_PERIOD_ID is 0
DEFAULT FOR CMP_IV_COMPONENT_ID is 0
DEFAULT FOR PER_ASG_GRADE_NAME IS '000'
INPUTS ARE CMP_IV_PERIOD_ID , CMP_IV_COMPONENT_ID
L_DATA_TYPE = 'DATE'
return L_DATA_TYPE, l_posting_date
I am using a custom pl/sql function GET_POSTING_DATE which returns date type value.
You're using the wrong variable name for your return variable.
Change l_posting_date to l_default_value.
CMP_IV_COMPONENT_ID should definitely be a valid input value.
also, there is a formula function that allows you to print debug messages into the ESS log file during execution.
Try the function ESS_LOG_WRITE:
L_TEMP = ESS_LOG_WRITE('Some custom debug text')
This way you can verify that the formula is indeed executed. Also, you can check the values for your database items and your custom function this way.
The compensation FF i am working on, does not allow DBI usage. Also, the requirement from client is to use an Element entry input value defined on employee element entry, and apply additional logic to get to Default value of the custom field in the worksheet.
Please advice if there is any other way to get to Element entry values, without using Custom Formula Function OR Database items.
I don't understand why you can't use DBI in this formula. The above formula provided by user 1001876 is also using PER_ASG_GRADE_NAME DBI. If you have element 'ABC_ELE' and input value 'XYZ_IV', you should be able to use ABC_ELE_XYZ_IV_ASG_ENTRY_VALUE DBI. This DBI uses PAYROLL_ASSIGNMENT_ID and EFFECTIVE_DATE contexts. Please make sure these contexts are set when you access this DBI. If needed, you can use CHANGE_CONTEXTS function to set context.
Thanks for your guidance.
The Compensation FF documentation states that "Database items are not available to formulas of this type." that's why i thought we can't use them.
Below is my code based on your comments, but still not getting the default value populated. Any help will be highly appreciated.
DEFAULT FOR STOCK_OPTIONS_NUMBER_OF_SHARES_ASG_ENTRY_VALUE IS 0
DEFAULT FOR ASG_HR_ASG_ID IS 0
L_INPUT_VALUE = 0
L_ASG_ID = 0
L_ASG_ID = ASG_HR_ASG_ID
L_TEMP = ESS_LOG_WRITE('VALUE OF ASG_HR_ASG_ID is '|| to_char(L_ASG_ID ))
L_PL_START_DATE = TO_DATE('2013/06/19','YYYY/MM/DD')
CHANGE_CONTEXTS(EFFECTIVE_DATE = L_PL_START_DATE , PAYROLL_ASSIGNMENT_ID = L_ASG_ID )
L_INPUT_VALUE = STOCK_OPTIONS_NUMBER_OF_SHARES_ASG_ENTRY_VALUE
L_TEMP = ESS_LOG_WRITE('Effective date is '|| to_char(L_PL_START_DATE ))
L_TEMP = ESS_LOG_WRITE('element value is '|| to_char(L_INPUT_VALUE))
L_DATA_TYPE = 'NUMBER'
L_DEFAULT_VALUE = to_char(L_INPUT_VALUE )
RETURN L_DATA_TYPE, L_DEFAULT_VALUE
Also, below is the values generated by the log file, which shows the assignment id of the person.
VALUE OF ASG_HR_ASG_ID is 300000001207065
Effective date is 2013-06-19T00:00:00.000Z
element value is 0
Please note ASG_HR_ASG_ID and PAYROLL_ASSIGNMENT_ID are not same in Fusion. That's why it' not returning any value as element entries are created for payroll assignment id. Since you are able to get value for ASG_HR_ASG_ID, it must be setting value for PAYROLL_ASSIGNMENT_ID as well. Please check value for PAYROLL_ASSIGNMENT_ID and EFFECTIVE_DATE context using following code:-
L_EFFECTIVE_DATE_TEMP='0001/01/01 00:00:00' (Date)
L_PAY_ASG_ID = GET_CONTEXT( PAYROLL_ASSIGNMENT_ID, -1)
If it's returning value, it means payroll assignment id and effective date contexts are already set and you don't need to set them explicitly. You can directly get value for STOCK_OPTIONS_NUMBER_OF_SHARES_ASG_ENTRY_VALUE.
Hope this help!