A delete action removes an item or a record from an application. For example, you can delete each lead that’s deemed to have gone “cold” from your CRM application. Or you can delete a file from a file management system after archiving it to a new storage location, or delete a folder and its contents.
Specifying filter conditions and error handling for the items to delete
When you add a delete action to your flow, you indicate which item or record you want to delete by specifying a mandatory default condition. Based on the application, this can either be an ID or some other criterion, which you can specify as a text value or by mapping to a field from a previous node. Examples:
For some applications, you might also need to specify additional values to indicate where an item should be deleted from. These values are typically presented in drop-down lists, which are populated by the application that you’re connected to. For example, if you want to delete a comment from a Jira issue, you need to select the project and issue that contain the comment, and then specify the comment ID.
After you specify a value for your filter condition, define what should happen if App Connect finds no items to delete:
- Continue processing any remaining nodes in the flow, but issue a response code of ‘204: No content’.
- Choose to exit the flow at that point and issue a ‘404’ error.
- Depending on the application you’re deleting items from, either a soft or a hard (permanent) deletion will occur. A soft deletion typically flags a record as “deleted” and hides it from normal view, but a privileged user (such as an administrator) can still access that record. For example, a Salesforce delete action will move a record to the Recycle Bin in your Salesforce instance, and you’ll be able to undelete the record or permanently delete it by emptying the bin if required.
- Some records have dependencies that will prohibit a deletion, so you’ll need to factor those dependencies into your flow. For example, you can’t delete a Salesforce account if it has one or more associated cases, so in your flow, you might want to check for and delete associated cases before deleting an account:
To help you design your flows, check the documentation for the application to see whether any dependencies exist for the type of record you are trying to delete.
You can also decide what action to take based on the status code that you get in response to the delete action. For example, you can use an “If” node to perform different actions for different status codes. The status codes that are returned for a delete action are:
- 200: An item or record that matched the filter condition was successfully deleted
- 204: No item or record matching the filter condition was found
You can map to the status code that a delete action returns by expanding the Response info node in the list of available inputs. The following example shows how you can map to a status code that’s returned for a Salesforce “Delete account” action. (The value can be set to
204 as required.)
To see a sample use case for the delete functionality in App Connect, see Calling a Delete operation from Salesforce.