Loading
Prepare for Email to Become the Default Login ExperienceRead More
Batch Management
Create a Flow to Delete Closed Cases

Create a Flow to Delete Closed Cases

Create a business flow to automatically delete cases. All closed cases get deleted, except for medium and high priority cases that were escalated.

Required Editions

View supported editions.
User Permissions Needed
To create a business flow: Manage Flows system permission
  1. Click Setup icon, and select Setup.
  2. In the Quick Find box, search and select Flow.
  3. Click New Flow.
  4. Select Autolaunched Flow (No Trigger), and click Next.
  5. Drag the Get Records action onto the canvas, and provide the following details:
    • Label: Get all case records
    • Object: Case
    • Condition Requirements: All Conditions Are Met
      • Field: Id
      • Operator: Equals
      • Value: Create a Variable type resource, and select the data type as Text. Name the variable as RecordID, and make it available as an input outside the flow.
        Note
        Note This input variable helps the batch job identify each unique record that it must process.
  6. Click Done | Done.
  7. Connect the Start element with the Get Records element.
  8. Drag the Decision action onto the canvas, and complete the following steps:
    1. Define the decision for the low priority cases:
      • Label: Low Priority
      • When to Execute Outcome: All Conditions Are Met
      • Condition Requirements:
        • Resource: {!Get_all_case_records.Priority}
        • Operator: Equals
        • Value: Low
    2. Click Add button.
    3. Define the decision for the medium and high priority cases:
      • Label: High or Medium Priority
      • When to Execute Outcome: All Conditions Are Met
      • Condition Requirements:
        • Condition 1:
          • Resource: {!Get_all_case_records.Priority}
          • Operator: Does Not Equal
          • Value: Low
        • Condition 2:
          • Resource: {!Get_all_case_records.IsEscalated}
          • Operator: Equals
          • Value: False
  9. Click Done.
  10. Connect the Get Records element with the Decision element.
  11. Drag the Delete Records action onto the canvas, and provide the following details:
    • Label: Delete Low Priority Cases
    • How to Find Records to Delete: Use the IDs stored in a record variable or record collection variable.
    • Record or Record Collection: {!Get_all_case_records}
  12. Click Done.
  13. Drag another Delete Records action onto the canvas, and provide the following details:
    • Label: Delete Medium or High Not Escalated Cases
    • How to Find Records to Delete: Use the IDs stored in a record variable or record collection variable.
    • Record or Record Collection: {!Get_all_case_records}
  14. Click Done.
  15. Connect the two Delete elements with the Decision element.
  16. Click Save.
  17. Name the flow as Delete Closed Cases, and click Save.
  18. Activate the flow.

Create a batch job that processes this flow.

See Also

 
Loading
Salesforce Help | Article