Problem
When a Case record is created in Salesforce, the expected CloudSense Orchestrator Process is not automatically created. The Case is created successfully, but no corresponding Orchestrator Process or Case Artifact record is generated.
This prevents automated workflows from executing, causing manual intervention to be required for processes that should be automated.
Cause
The issue occurs when a custom Apex trigger or class is configured to automatically create Orchestrator Processes from Case records, but the trigger has conditional logic that prevents the process from being created.
Common Trigger Conditions
Custom implementations often include conditions such as:
- Case_Artifact__c must be blank: If the Case Artifact field is already populated at creation time, the trigger assumes a process already exists and skips creation.
- Specific Record Type: The trigger only creates processes for certain Case Record Types.
- Specific Status or External Status: The trigger only creates processes when the Case has a specific status value.
- Custom Field Values: The trigger checks custom fields (e.g.,
External_status__c,Available_Elements_Internal__c) and only creates processes when certain conditions are met.
Example Custom Trigger Logic
// Example from CS_CaseTriggerDelegate Apex Class
public class CS_CaseTriggerDelegate {
public void createOrchestratorProcess(List<Case> cases) {
for (Case c : cases) {
// Condition: Case_Artifact__c must be blank
if (c.Case_Artifact__c == null || c.Case_Artifact__c == '') {
// Create Orchestrator Process
createProcess(c);
}
}
}
}
If the Case_Artifact__c field is populated at creation time (e.g., by another trigger, workflow, or process builder), the condition fails, and the Orchestrator Process is not created.
Resolution
Step 1: Identify the Custom Trigger or Class
- Navigate to Setup > Apex Triggers in Salesforce.
- Locate the trigger on the
Caseobject (e.g.,CaseTrigger,CS_CaseTriggerDelegate). - Review the trigger code to identify the class or method responsible for creating Orchestrator Processes.
Step 2: Review the Trigger Conditions
- Open the Apex class referenced by the trigger (e.g.,
CS_CaseTriggerDelegate). - Locate the method that creates Orchestrator Processes (e.g.,
createOrchestratorProcess). - Identify the conditions that must be met for the process to be created.
Example Conditions:
- Case_Artifact__c must be blank
- RecordType.Name must match a specific value
- External_status__c must match a specific value
- Other custom field conditions
Step 3: Check the Affected Case Records
- Query the Case records that did not have Orchestrator Processes created:
SELECT Id, Status, Case_Artifact__c, External_status__c, CreatedDate, ClosedDate, RecordType.Name
FROM Case
WHERE External_status__c = 'Pending Revoke' -- Adjust based on your criteria
AND CreatedDate = THIS_MONTH
- Review the field values for the affected cases.
- Identify which condition in the trigger logic is preventing the process from being created.
Example: If all affected cases have Case_Artifact__c populated, but the trigger requires it to be blank, this is the blocking condition.
Step 4: Correct the Data or Process
Depending on the root cause, choose one of the following approaches:
Option A: Ensure Conditions Are Met at Creation Time
If the trigger conditions are correct and should be enforced:
- Review the process that creates Case records (e.g., another trigger, workflow, process builder, or external integration).
- Ensure that the blocking field (e.g.,
Case_Artifact__c) is not populated at creation time. - If the field is populated by another automation, adjust the order of execution or the logic to ensure the Orchestrator Process trigger runs first.
Option B: Adjust the Trigger Logic
If the trigger conditions are too restrictive:
- Review the business requirements for when Orchestrator Processes should be created.
- Update the trigger logic to adjust or remove the blocking condition.
- Deploy the updated trigger to production.
Example: If Case_Artifact__c should be allowed to be populated at creation time, update the trigger logic:
// Before: Strict condition
if (c.Case_Artifact__c == null || c.Case_Artifact__c == '') {
createProcess(c);
}
// After: Allow Case_Artifact__c to be populated
createProcess(c);
Step 5: Enable Field History Tracking (Optional)
To diagnose similar issues in the future, enable Field History Tracking for the fields involved in the trigger conditions:
- Navigate to Setup > Object Manager > Case > Fields & Relationships.
- Locate the field (e.g.,
Case_Artifact__c). - Click Set History Tracking and enable tracking for the field.
- This allows you to see when and how the field value changes, helping identify which automation is populating it.
Step 6: Test the Fix
- Create a new Case record that meets the trigger conditions.
- Verify that the Orchestrator Process is created automatically.
- Verify that the Case Artifact record is created (if applicable).
Prevention
- Code Review: When implementing custom triggers that create Orchestrator Processes, clearly document the conditions that must be met.
- Unit Tests: Implement unit tests that cover scenarios where:
- All conditions are met (process should be created).
- One or more conditions are not met (process should not be created).
- Field History Tracking: Enable field history tracking for fields used in trigger conditions to aid in troubleshooting.
- Order of Execution: Be aware of Salesforce's order of execution for triggers, workflows, and process builders. Ensure that the Orchestrator Process trigger runs at the appropriate time.
Additional Notes
- This issue is specific to implementations with custom Apex triggers that create Orchestrator Processes from Case records.
- The exact trigger name, class name, and field names may vary depending on your implementation.
- Out-of-the-box CloudSense Orchestrator does not automatically create processes from Case records unless custom code is implemented.
- If you are unsure which trigger or class is responsible for creating Orchestrator Processes, search for references to
cspofa__Orchestrator_Process__corCase_Artifact__cin your Apex code.
Priyanka Bhotika
Comments