Posts

Showing posts from November, 2025

groovy fixed

/* * Field-Level Trigger on BBAction_c * Trigger Name: BBAction_AutoSet_Fields * Trigger Type: After Field Changed * * This trigger automatically sets related fields based on BBAction_c selection * and validates business rules for different incentive types and scenarios. */ // ============================================================================ // SECTION 1: Approve Beginning Balance (Pay Full Amount) // Action Code: MAV_DIR_BB_ACTION_1006 // ============================================================================ if (BBAction_c == 'MAV_DIR_BB_ACTION_1006') { println("[BBAction Trigger] Action: Approve Beginning Balance (Pay Full Amount)") println("[BBAction Trigger] IncentiveType: ${IncentiveType_c}") // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { println("[BBAction Trigger] Clearing BBReasonCo...

Groovy

/* Comment out Vishal as code moved to Validation rules /*def allowedActions = [ "MAV_DIR_BB_ACTION_1003", "MAV_DIR_BB_ACTION_1000", "MAV_DIR_BB_ACTION_1001", "MAV_DIR_BB_ACTION_1002" ]y y //RUN ONLY WHEN ANALYST WORKS //if(!adf.context.getSecurityContext()?.getUserName().equals(getIntegrationUser()['user'])){ if(isAttributeChanged('BBAction_c')){ //VALIDATION FOR PREPOPULATED VALUES if(allowedActions.contains(BBAction_c)){ //throw new oracle.jbo.ValidationException("BB ACTION : You can not select default values!"); } else{ //MAKING REASON CODE AND COMMENT AS BLANK BBReasonCode_c = null; BBMPAComment_c = null; ExpectedPaymentAmount_c = 0; } }*/ //==== Vishal - checking first field levle trigger // Field-Level Trigger on BBAction_c // Trigger Name: BBAction_HoldBeginningBalance_AutoSet // Trigger Type: Afte...

row 4 script

// Field-Level Trigger on BBAction_c // Trigger Name: BBAction_HoldBeginningBalance_AutoSet // Trigger Type: After Field Changed // Row 4 Condition: // - Incentive Type = COMMISSION or BONUS // - BBAction = Hold Beginning Balance (MAV_DIR_BB_ACTION_1007) // - NO other conditions (HRStatus, Country, SalesRP, Consent, CED, BB are all null) if (BBAction_c == 'MAV_DIR_BB_ACTION_1007') { // Verify the Incentive Type condition (COMMISSION or BONUS, not SPIFF) if (IncentiveType_c == 'COMMISSION' || IncentiveType_c == 'BONUS') { // Calculate reverse of Beginning Balance: (-1) * BeginningBalance_c def reverseBB = -1 * (BeginningBalance_c ?: 0) // Set MPAGenerated only if value is different (avoid validation threshold) if (MPAGenerated != reverseBB) { MPAGenerated = reverseBB } // Set MPAStatus_c to 'Auto approved' if (MPAStatus_c != 'Auto approved...

CODE

Pre-approved full BB within the threshold for active sale rep MAV_DIR_BB_ACTION_1000 Pre-approved full CED (0-10USD) for termed rep MAV_DIR_BB_ACTION_1001 Auto hold full beginning balance MAV_DIR_BB_ACTION_1002 Auto hold full CED MAV_DIR_BB_ACTION_1003 Approve Beginning Balance (Pay Full Amount) MAV_DIR_BB_ACTION_1004 Hold Beginning Balance (Full BB on Hold Until next month – no MPA required) MAV_DIR_BB_ACTION_1005 REC Payout Adjustment (Analyst needs to fill in Expected Payout) MAV_DIR_BB_ACTION_1006 NNREC Payout Adjustment (Analyst needs to fill in Expected Payout) MAV_DIR_BB_ACTION_1007 MPA to Write Off MAV_DIR_BB_ACTION_1008 MPA to Payroll Collections MAV_DIR_BB_ACTION_1009 SPIF vs Comm deduction MAV_DIR_BB_ACTION_1010 Approve Beginning Balance (Pay Full BB Amount)

new groovy

// Groovy Script for BBAction_c After Field Changed Trigger (Central Automation Hub) // This script executes when BBAction_c is changed and acts as the central hub // for all automation (prepopulation) logic driven by the BBAction value. // --- Helper Function: Check for Null/Empty Fields --- def areBeforeFieldsEmpty() { // This function encapsulates the check for all mandatory "before fields" being null/empty. // isAttributeNullOrEmpty() is the standard and safest way to check. return isAttributeNullOrEmpty(HRStatus_c) && isAttributeNullOrEmpty(RoleName_c) && isAttributeNullOrEmpty(EmploymentCountry_c) && isAttributeNullOrEmpty(SalesRP_c) && isAttributeNullOrEmpty(EmployeeConsent_c) && isAttributeNullOrEmpty(HRTI_c) && isAttributeNullOrEmpty(CEDUSD_c) && // Included the CEDUSD_c field isAttributeNullOrEmpty(cCED_c) && ...

bb code st

// Groovy Script for BBAction_c After Field Changed Trigger (Set BBReasonCode_c) // This script executes when BBAction_c is changed. // If BBAction_c is set to 'LOOKUP1' AND a list of specific fields are all null/empty, // it sets BBReasonCode_c to 'Analyst to select'. // --- Configuration --- def TARGET_ACTION_VALUE = 'LOOKUP1' def TARGET_REASON_CODE = 'Analyst to select' // --- End Configuration --- println("--- BBAction_c Set BBReasonCode_c Trigger Fired ---") // 1. Check if the BBAction_c has been set to the target value if (BBAction_c == TARGET_ACTION_VALUE) { println("DEBUG | BBAction_c is set to: " + TARGET_ACTION_VALUE) // 2. Define the check for all mandatory "before fields" being null/empty. // isAttributeNullOrEmpty() handles various field types (string, number, date) // and is the safest way to check. def allBeforeFieldsEmpty = isAttributeNullOrEmpty(HRStatus_c) && ...

new

// Groovy Script for BBAction_c Field Level Validation Rule // *** TEMPORARY: Use this script ONLY to confirm the trigger is firing and logging is active. *** println("--- BBAction_c Validation Trigger Fired (Simple Test) ---") println("Timestamp: " + new Date()) println("Logged-in User (adf.context.security.userName): " + adf.context.getSecurityContext()?.getUserName()) println("New Value (BBAction_c): " + BBAction_c) println("Old Value (oldValue): " + oldValue) println("--- End Simple Test ---") // Always return true so the transaction commits, regardless of the values. return true

Validation Rule

def FORBIDDEN_VALUES = [ 'MAV_DIR_BB_ACTION_1003', 'MAV_DIR_BB_ACTION_1000', 'MAV_DIR_BB_ACTION_1001', 'MAV_DIR_BB_ACTION_1013' ] // 2. Define the user identifier that should trigger this validation. // *** IMPORTANT: This must exactly match the string returned by adf.context.security.userName def TARGET_USER_ID = 'OIC1@nomail.com' // Get the current logged-in user's ID/Username def currentUserID = adf.context.getSecurityContext()?.getUserName() // BBAction_c holds the NEW value that the user has selected/entered. def newBBActionValue = BBAction_c // Check the original value of the field from the database/before modification. def oldBBActionValue = oldValue // Check 1: Has the field value actually changed from its original state? // Check 2: Is the new value in the forbidden list? (Updated logic using contains()) // Check 3: Is the logged-in user the target user? if (newBBActionValue != oldBBActionValue && ...

MPA report generated

-- MPA Report with Manual MC Adjustment rows SELECT EXTN_ATTRIBUTE_CHAR032 AS Paysheet_ID, 'Auto Approved' AS MPA_Status, EXTN_ATTRIBUTE_CHAR002 AS Plan_component_Id, 'N' AS Recoverable_flag, CURRENCY_CODE AS Home_currency_code, EXTN_ATTRIBUTE_NUMBER035 AS Home_currency_amount, -- MPA Adjusted EXTN_ATTRIBUTE_CHAR020 AS Incentive_type, EXTN_ATTRIBUTE_CHAR003 AS Badge_Id, EXTN_ATTRIBUTE_NUMBER001 AS Period_ID, EXTN_ATTRIBUTE_CHAR011 AS PrePayHub_Status, OWNER_RESOURCE_ID, EXTN_ATTRIBUTE_NUMBER002 AS PARTICIPANT_ID, EXTN_ATTRIBUTE_CHAR001 AS PAYRUN_ID, ID AS RECORD_ID, (SELECT bu_id FROM fun_all_business_units_v WHERE bu_name = 'ICM_DIRECT_INCTV') AS BU_ID, EXTN_ATTRIBUTE_CHAR041 AS MPA_REASON_CODE FROM ZCA_REF_ENTITIES zre WHERE zre.ATTRIBUTE_CATEGORY = ...

MPA query

-- Report MPA Report Enhancement Hight level - Report is to be called by integration to pull data from Prepaid Hub " Where payment batch status = Unpaid" and add a new line for Manual adjustment for adjustments happening due to Multi Currency scenarios. Condition - New record to be created whenever column MC Adjustment is not Null and not equal to 0. -- MPA Report Enhancement Hight level Report is to be called by integration to pull data from Prepaid Hub " Where payment batch status = Unpaid" and add a new line for Manual adjustment for adjustments happening due to Multi Currency scenarios. Condition to Create new Manual Record - New record to be created whenever column MC Adjustment is not Null and not equal to 0. Technical One sql query will create the manual adjustment record for Actual MPA We will have one more manual adjustment record for MPA requried because of Multi Currency adjustment. BOth queries will work b...

Final BB query for efactring and analysis and fixes

/* Multi-Currency Paysheet Report - OPTIMIZED WITH FILTERS Aggregates payment data with currency conversions (Home USD) Filters: :payrun_id, :participant_id, :period_id (all optional) */ WITH -- Materialize conversion rates once CONVERSION_RATES_USD AS ( SELECT CR.FROM_CURRENCY, CR.TO_CURRENCY, CR.CONVERSION_START_DATE, CR.CONVERSION_END_DATE, CR.CONVERSION_RATE FROM CN_CONVERSION_RATES CR INNER JOIN CN_CONVERSION_TYPES_TL CT ON CT.CONVERSION_TYPE_ID = CR.CONVERSION_TYPE_ID WHERE CT.CONVERSION_TYPE_ID = '-1001' AND CT.LANGUAGE = 'US' AND CR.TO_CURRENCY = 'USD' ), -- Materialize person numbers once - FILTERED PERSON_NUMBERS AS ( SELECT distinct cspl.participant_id, papf.person_number, cspl.PARTICIPANT_NAME FROM CN_SRP_PARTICIPANTS_ALL cspl INNER JOIN hz_person_profiles hpp ON cspl.party_id = hpp.party_id INNER JOIN PER_ALL_PEOPLE_...