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) && isAttributeNullOrEmpty(RoleName_c) && isAttributeNullOrEmpty(EmploymentCountry_c) && isAttributeNullOrEmpty(SalesRP_c) && isAttributeNullOrEmpty(EmployeeConsent_c) && isAttributeNullOrEmpty(HRTI_c) && isAttributeNullOrEmpty(CEDUSD_c) && isAttributeNullOrEmpty(cCED_c) && isAttributeNullOrEmpty(PTDEarnings_c) && isAttributeNullOrEmpty(BeginningBalance_c) println("DEBUG | All Before Fields Empty Status: " + allBeforeFieldsEmpty) // 3. If all before fields are empty, set the reason code if (allBeforeFieldsEmpty) { BBReasonCode_c = TARGET_REASON_CODE println("DEBUG | Action Success: BBReasonCode_c set to '" + TARGET_REASON_CODE + "'") } else { println("DEBUG | Action Skipped: One or more fields were populated.") } } else { println("DEBUG | Action Skipped: BBAction_c value (" + BBAction_c + ") does not match target value (" + TARGET_ACTION_VALUE + ")") } println("--- BBAction_c Set BBReasonCode_c Trigger Finished ---") return

Comments

Popular posts from this blog

dev7 from eror

EPA

Unified Currency Report- Krithika