Let me provide a comprehensive solution for handling goal purge operations while maintaining referential integrity and implementing proper cascade deletion.
Understanding Goal Purge by ID Limitations
The Data Retention Management tool’s goal purge by ID function operates at the individual goal level without automatic cascade logic. This is by design because SuccessFactors prioritizes data preservation - the system assumes you want explicit control over what gets deleted rather than automatic cascading that might remove data unintentionally.
When you purge a parent goal by ID:
- The parent goal record is deleted from the database
- Child goals remain with their parentGoalId field still referencing the deleted parent
- This creates orphaned records that show errors when accessed through UI
- Reporting queries that join parent-child relationships return incomplete results
Referential Integrity Strategy
To maintain database integrity during goal purges, you must explicitly handle the complete goal hierarchy. Here’s a systematic approach:
Step 1 - Extract Complete Goal Hierarchy:
Query your goal data to map the full parent-child relationship tree. Use this query structure:
SELECT
parent.goalId AS parentGoalId,
child.goalId AS childGoalId,
child.parentGoalId,
child.goalLevel
FROM goals parent
LEFT JOIN goals child ON parent.goalId = child.parentGoalId
WHERE parent.goalId IN ('your_parent_id_list')
This identifies all direct children. For multi-level hierarchies (parent > child > sub-child), run recursive queries or use the goal hierarchy export feature in Admin Center.
Step 2 - Build Deletion Sequence:
Organize goals for deletion in reverse hierarchical order:
- Level 3 (sub-children) delete first
- Level 2 (children) delete second
- Level 1 (parents) delete last
This sequence prevents referential integrity violations during the deletion process.
Step 3 - Create Consolidated Purge List:
Combine all goal IDs (parents + children + sub-children) into a single purge file. Format as CSV with goalId column. For your 1,200 parent goals with average 3-4 children each, expect approximately 4,800-6,000 total goal IDs in your purge list.
Cascade Deletion Implementation
Option 1 - Manual Data Retention Tool Approach:
Use the Data Retention Management tool with your consolidated purge list:
- Navigate to Admin Center > Data Retention Management > Goal Purge
- Select ‘Purge by Goal ID’
- Upload your consolidated CSV file with all goal IDs (sorted in reverse hierarchical order)
- Run purge in test mode first to validate the deletion scope
- Execute actual purge during off-peak hours
- Monitor purge logs for any referential integrity errors
Advantages: Uses standard tool, no custom development, audit trail maintained
Disadvantages: Manual hierarchy extraction, requires careful sorting, limited error recovery
Option 2 - OData API Approach:
Implement programmatic deletion using the SuccessFactors OData API:
<!-- Pseudocode for API-based cascade deletion -->
1. Query goal hierarchy via OData:
GET /odata/v2/Goal?$filter=parentGoalId eq 'parent_id'&$select=goalId,parentGoalId
2. Build deletion array in reverse hierarchy order
3. Delete goals iteratively:
DELETE /odata/v2/Goal('child_goal_id_1')
DELETE /odata/v2/Goal('child_goal_id_2')
DELETE /odata/v2/Goal('parent_goal_id')
4. Implement error handling and rollback logic
Advantages: Automated hierarchy traversal, better error handling, can be scheduled for recurring cleanup
Disadvantages: Requires API expertise, needs authentication setup, more complex implementation
Option 3 - Goal Plan Template Configuration:
Check your goal plan template settings for cascade options:
- Navigate to Admin Center > Manage Goal Plan Template
- Select your active goal plan template
- Review ‘Goal Relationship Settings’ section
- Look for ‘Cascade Delete’ or ‘Orphan Handling’ options
- If available, enable ‘Delete child goals when parent is deleted’
Note: This option is template-dependent and may not be available in all SuccessFactors versions (specifically check sf-h1-2023 release notes for this feature availability).
Data Cleanup Strategy for Large-Scale Purges
For your specific scenario (1,200 parent goals from 2020-2021):
Phase 1 - Data Analysis (Week 1):
- Export all goals from 2020-2021 target period
- Map complete parent-child-subchild relationships
- Identify any goals still referenced in active performance reviews or compensation plans
- Calculate total deletion scope (expect 4,800-6,000 goals based on your averages)
Phase 2 - Pilot Purge (Week 2):
- Select 50 parent goals (approximately 200 total goals including children)
- Execute purge using consolidated ID list approach
- Validate no orphaned records remain
- Verify reporting queries return correct results
- Check for any unexpected referential integrity errors
Phase 3 - Staged Production Purge (Weeks 3-4):
- Divide remaining goals into 4 batches of 300 parents each (1,200 total goals per batch)
- Execute one batch per week during maintenance windows
- Monitor system performance during and after each batch
- Validate data integrity between batches
Phase 4 - Verification (Week 5):
- Run comprehensive data integrity checks
- Verify no orphaned goal records exist
- Confirm reporting dashboards show correct goal counts
- Document final purge statistics and any issues encountered
Preventing Future Integrity Issues
Implement these ongoing practices:
-
Quarterly Goal Audits: Run automated checks for orphaned goals using SQL queries that identify goals with parentGoalId values referencing non-existent parents
-
Purge Documentation: Maintain a purge log documenting which parent goal IDs were purged, deletion date, total child goals affected, and any integrity issues encountered
-
Automated Hierarchy Extraction: Create a scheduled job that exports goal hierarchies monthly, making future purge planning easier
-
Pre-Purge Validation: Before any goal purge operation, run validation queries to ensure no active references exist (performance reviews, compensation plans, development plans)
This comprehensive approach ensures clean goal data removal while maintaining referential integrity throughout your SuccessFactors instance.