To ensure a high-performance, scalable integration, the Case Status for Litify synchronization is split into two distinct parts: a Trigger Wrapper and a Logic Subflow. This "Decoupled Architecture" ensures that your Salesforce performance remains lightning-fast while maintaining complex business rules in the background.
Part 1: The Orchestrator (Trigger Wrapper)
Flow API Name: Case_Status_Sync_Matter
The Trigger Wrapper is a lightweight "listening" flow. Its only job is to detect when a change happens on a Matter and queue it for processing.
Why It’s Efficient:
Asynchronous Execution: It uses a "Scheduled Path" (Async After Commit). This means Salesforce finishes saving your record first, and the sync happens a few seconds later. Your users won't experience "spinning wheels" while waiting for an integration to finish.
Change Detection: The flow only triggers if specific, relevant fields are updated (e.g., Matter Stage, NPS, Branding ID, or Attorney assignments).
Tracked Fields (Trigger Surface)
Updates to any of the following fields will initiate a sync attempt:
Matter TeamorPrincipal AttorneyMatter PlanorMatter Stage ActivityClosed DateNPS__cClient (Party)Branding_ID__c
Part 2: The Engine (Logic Subflow)
Flow API Name: Case_Status_Matter_Sync_Logic
Once the Trigger Wrapper confirms a change has occurred, it hands the record ID to this Subflow. This is where the "heavy lifting" happens.
The 7 Execution Gates
Before data is sent to Case Status, it must pass through these validation gates:
Invocation Gate: Verifies a valid Matter ID was received.
Settings Gate: Retrieves your API Key and Base URL from Custom Metadata.
Readiness Gate: Crucial Step. The sync will fail if the Client Phone or Principal Attorney Email is missing.
Branding Gate: If your firm uses multiple brands, it resolves which logo/theme to apply.
Team Assembly: Loops through your Matter Team and collects emails for all users in allowed roles (to ensure they are synced as "Staff" in Case Status).
External Sync: Calls the Case Status Apex Action (
CStatus__CaseStatusProcessCaseV2) to create or update the record.Success Stamp: Upon a successful response, it updates the
Synced_with_Case_Status__ctimestamp on the Matter.
Troubleshooting & Support
"Why didn't my Matter sync?"
If a Matter fails to appear in Case Status, check these common "silent" blockers:
Missing Data: Does the Client have a phone number? Does the Principal Attorney have an email?
Role Mapping: Is the staff member on the Matter Team in an "Allowed Role"?
API Configuration: Is the API Key in Custom Metadata still valid?
Error Logging
This integration uses a centralized logging system. If an error occurs during the Logic Subflow, a record is created in the Case Status Log Error object. These logs capture the specific element that failed and the exact error message from the Salesforce platform.
Maintenance Note
One Logic Flow to Rule Them All: Because all logic is consolidated into the Case_Status_Matter_Sync_Logic subflow, you can trigger a sync via a button, Apex, or scheduled job using this same logic. This ensures your business rules remain consistent regardless of how the sync is started.
