Delete Data
Overview
The Delete Data stage removes data that was previously stored using the Save Data stage. You can delete a specific record, an individual key within a record, or all records in a group.
Use this stage to clean up temporary data, remove outdated information, or delete sensitive data after it is no longer needed.
* Example flow demonstrating how Delete Data removes a stored key and how Fetch Data returns the configured default value when the key is no longer available.
Note: The variable names, values, criteria, and configuration used in this example are for demonstration purposes only.
Configuration
Fields Reference
| Field | Required | Description | Example |
|---|---|---|---|
| Group name | Yes | The group containing the data to delete. The value must match the group name used when the data was saved. | UserSessions TempCache |
| Record name | No | The specific record to delete. Leave this field empty only when you intend to delete all records in the group. | {{sessionId}} |
| Key | No | The individual key to remove from the selected record. Use this field when you want to delete one value without removing the entire record. | emailAddress |
Deletion Scope
| Fields Provided | What Gets Deleted | Example |
|---|---|---|
| Group name only | All records in the group | Delete all test records from TestData |
| Group name + Record name | One specific record in the group | Delete the record identified by {{sessionId}} |
| Group name + Record name + Key | One key from one specific record | Delete emailAddress from a selected customer record |
| Group name + Key | The matching key from all records in the group | Delete phoneNumber from every record in the group |
Important: Leaving Record name empty can delete all records in the selected group. Confirm the intended deletion scope before enabling the flow.
Exit Points
| Exit | When It Is Used |
|---|---|
| Pass | The deletion completes successfully. The stage may also continue through Pass when no matching data is found. |
| Error | The deletion cannot be completed because of a data-store or connection error. |
How It Works
When the stage executes, it:
- Reads the configured values for Group name, Record name, and Key.
- Determines the deletion scope from the fields that were provided.
- Deletes the matching data from storage.
- Continues through Pass or Error depending on the result.
Key behavior: Delete Data permanently removes the selected data. The stage does not provide an undo option.
Example: Delete a Temporary Record
This example removes a temporary record after the flow no longer needs it.
| Step | Stage | Result |
|---|---|---|
| 1 | Save Data | Stores a temporary record using {{processId}} |
| 2 | Delete Data | Removes the same record after processing is complete |
| 3 | Fetch Data | No matching record is returned |
Delete Data configuration:
- Group name:
TempProcessing - Record name: {{processId}}
- Key: Leave empty
Common Use Cases
1. Clean Up Temporary Data
Remove temporary processing data after the flow has completed all stages that depend on it.
- Group name:
TempProcessing - Record name: {{processId}}
2. Delete a User Session
Remove a stored session after logout or session expiry.
- Group name:
UserSessions - Record name: {{sessionId}}
3. Clear Test Data
Remove all records from a test group.
- Group name:
TestData - Record name: Leave empty
- Key: Leave empty
Warning: This configuration deletes every record in the group.
4. Remove One Key from a Record
Delete one stored value without removing the complete record.
- Group name:
CustomerData - Record name: {{customerId}}
- Key:
temporaryToken
Key Behaviors
| Feature | Behavior |
|---|---|
| Permanent Deletion | Deleted data cannot be restored by the stage. |
| Safe to Repeat | Deleting data that no longer exists does not normally create a deletion error. |
| Exact Name Matching | Group, record, and key values must match the stored data names exactly. |
| No Confirmation Prompt | The stage performs the deletion immediately when it executes. |
| No Output Variable | The stage does not create a variable containing a deletion count or deleted record. |
Best Practices
- ✓ Use a specific Record name whenever possible.
- ✓ Leave Record name empty only when deleting the entire group is intentional.
- ✓ Delete data only after every stage that depends on it has completed.
- ✓ Use Route Flow before Delete Data when deletion depends on a condition.
- ✓ Test deletion logic with temporary groups before using it with production data.
- ✓ Document flows that delete data from shared groups.
- ✓ Connect the Error exit to logging, alerting, or other failure handling.
- ✓ Use Fetch Data after deletion during testing when you need to verify the result.
Common Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| Leaving Record name empty unintentionally | All records in the selected group are deleted. | Provide the specific Record name when deleting one record. |
| Using a different group, record, or key name | The stage completes, but the expected data remains. | Match the names used by Save Data exactly. |
| Deleting data too early | Later stages cannot retrieve or use the data. | Move Delete Data after every stage that depends on the stored information. |
| Expecting a deleted-record count | No result variable shows what was removed. | Use Fetch Data during testing to verify that the record or key is no longer available. |
| Not handling the Error exit | A storage or connection problem is not handled by the flow. | Connect Error to a Log, Slack alert, or another appropriate error route. |
Troubleshooting
| Issue | Common Cause | Fix |
|---|---|---|
| Expected data was not deleted | The group, record, or key value does not match the stored data. | Compare the Delete Data configuration with the values used in Save Data. |
| Error exit is triggered | The data store is unavailable or incorrectly configured. | Check the data-store configuration and investigate the connection failure. |
| More data was deleted than expected | Record name was left empty. | Specify the exact record before running the flow again. |
| Later stages return no data | Delete Data executed before those stages completed. | Move the deletion stage to the end of the relevant processing path. |
Advanced: Clear Distributed Cache
If the stored data is also cached, the group name can be prefixed with clearcache:: to request cache clearing across the available engine servers.
Example:
clearcache::UserData
This can remove the stored value and request that cached copies are cleared. Use this option only when the relevant data is known to use distributed caching.
Related Stages
- Save Data: Store data that can later be removed with Delete Data.
- Fetch Data: Retrieve stored data or verify during testing that deletion succeeded.
- Query Data: Find stored records before deciding what should be deleted.
- Route Flow: Check conditions before allowing a deletion.
- Run Later: Schedule cleanup logic for a later time.