User Story
As a Salesforce Administrator,
I want to create a screen flow that allows users to delete API Log records based on a specified date range and a configurable deletion limit,
so that I can efficiently manage and clean up API Log records while maintaining system performance.
Acceptance Criteria:
-
Custom Object:
- A custom object named API Log must exist with the following fields:
- Log Name (Text)
- Is Error? (Checkbox)
- Log Message (Long Text Area)
- Log Type (Picklist: e.g., Info, Warning, Error)
-
Input Parameters in the Screen Flow:
- The flow must provide the following input options for the user:
- Date Range:
- Start Date: The beginning of the range for deletion.
- End Date: The end of the range for deletion.
- Deletion Limit:
- Allow the user to specify the number of records to delete.
- Enforce a maximum limit of 5000 records.
- Display an error message if the user enters a value greater than 5000 (e.g., “The deletion limit cannot exceed 5000 records.”).
-
Log Retrieval and Confirmation:
- The flow must retrieve all API Log records within the specified date range, limited to the user-defined deletion limit.
- Display the following details of the retrieved logs in a table for review:
- Log Name
- Is Error?
- Log Type
- Created Date
-
Deletion Confirmation:
- Provide the user with an option to confirm or cancel the deletion.
- If the user cancels, the flow should exit without making changes.
-
Deletion Process:
- Upon confirmation, the flow must:
- Delete the retrieved API Log records.
- Display a success message (e.g., “Successfully deleted X API Log records.”).
-
Error Handling:
- If no API Log records match the specified criteria, notify the user:
- Message: “No API Log records found within the specified date range.”
-
Performance Considerations:
- Ensure that the deletion process adheres to Salesforce governor limits.
- Use bulk deletion to handle larger record sets efficiently.