Skip to content

Flow Name: Case Sharing Criteria

Last Updated: 2024-09-30 Source Code: Case_Sharing_Criteria.flow-meta.xml

API Name: Case_Sharing_Criteria Status: Active Type: Custom Trigger: After save (create and update) of Case records

Business Purpose

This flow maintains accurate case sharing and access control by automatically updating the HR_Case__c field on Case records based on ownership. It enables proper case visibility and sharing rules by identifying which cases belong to the HR department through queue ownership detection.

Process Flow

  1. Queue Lookup: Retrieves the "HR_Queue" group record by developer name
  2. Ownership Analysis: Compares the Case owner with the HR queue ID
  3. Field Update Logic:
  4. Set HR_Case__c = true: If case is owned by HR queue AND field is not already true
  5. Set HR_Case__c = false: If case is NOT owned by HR queue AND field is not already false
  6. Record Update: Updates the Case record with the appropriate HR_Case__c value
📊 Click to view Process Flow Diagram
flowchart TD
    Start([Start: Case Create/Update<br/>After Save Trigger]) --> GetQueue[Get HR_Queue Group<br/>by developer name]

    GetQueue --> CheckOwner{Case Owner =<br/>HR Queue?}

    CheckOwner -->|Yes & HR_Case__c ≠ TRUE| SetTrue[Set Case.HR_Case__c<br/>= TRUE]
    CheckOwner -->|No & HR_Case__c ≠ FALSE| SetFalse[Set Case.HR_Case__c<br/>= FALSE]
    CheckOwner -->|Already Correct| End([End])

    SetTrue --> End
    SetFalse --> End

    style Start fill:#e1f5ff
    style GetQueue fill:#f0e1ff
    style CheckOwner fill:#fff4e1
    style SetTrue fill:#ffe1e1
    style SetFalse fill:#ffe1e1
    style End fill:#e1f5ff

Key Business Rules

  • Only processes cases when ownership or HR status changes
  • HR_Case__c field is set to true when Case.OwnerId equals HR_Queue.Id
  • HR_Case__c field is set to false when Case.OwnerId does not equal HR_Queue.Id
  • Prevents unnecessary updates when HR_Case__c field already matches the expected value
  • Works on both case creation and ownership changes

Dependencies

  • Case standard object with HR_Case__c custom field
  • Group standard object with "HR_Queue" developer name
  • Case sharing rules that reference the HR_Case__c field for visibility control
  • Case assignment rules that may assign cases to HR queue
  • PR-29901 (referenced in description)

⚠️ Pre-Go-Live Concerns

CRITICAL - Fix Before Go-Live

  • Queue Dependency: Flow will fail if "HR_Queue" group doesn't exist or is renamed
  • Sharing Rules Impact: Verify dependent sharing rules work correctly with HR_Case__c field updates

HIGH - Address Soon After Go-Live

  • Performance: Runs on every Case create/update - monitor for performance impact with high case volumes
  • Queue Management: No handling if HR queue is deactivated or ownership changes

MEDIUM - Future Enhancement

  • Error Handling: No notification if HR queue lookup fails
  • Audit Trail: No logging of HR case status changes for compliance tracking

LOW - Monitor

  • Field Usage: Verify HR_Case__c field is being used effectively by sharing rules and reports
  • Queue Membership: Monitor if HR queue membership changes affect case routing

Maintenance Notes

Complexity: Low - Simple lookup and field update logic with clear business purpose. Review quarterly to ensure HR queue name and sharing rule dependencies remain accurate. Monitor case volumes and consider bulk update handling if performance issues arise.