Deleting records by using a LoopBackRequest node

Use a LoopBackRequest node in a message flow to delete a data record through a LoopBack® connector such as MongoDB, Cloudant®, or PostgreSQL.

Before you begin

Complete the tasks in the following topics:

About this task

You delete a record by specifying Delete in the Operation property of the LoopBackRequest node, and specifying the ID of the record in the LocalEnvironment.Destination.Loopback.Request.id environment variable. If no record is found with a matching ID, an error is returned.

If no ID is specified, but an external ID name and value are specified in the LocalEnvironment.Destination.Loopback.Request.externalIdName and LocalEnvironment.Destination.Loopback.Request.externalId environment variables, the records with that external ID are deleted. In some cases, multiple records might match the same external ID. If no ID or external ID is specified, you can use a filter.where clause to specify the records to be deleted. For more information about filtering, see Filtering the records retrieved through a LoopBack connector.

When records are deleted, a result is returned from the installed connector, such as a count of the deleted records.

Procedure

Follow these steps to delete a record:

  1. Create a flow containing a LoopBackRequest node, and set the node properties:
    1. On the Basic tab, set the following properties:
      • In the Data source property, specify the name of the data source stanza for your chosen connector in the LoopBack datasources.json file.
      • In the Operation property, specify Delete.
      • In the LoopBack object property, select the type of object that you want to delete.
      • In the Security identity property, specify the security identity that you will use when connecting to the LoopBack application. For information about configuring the security identity on the integration node, see Specifying security credentials for connecting to a secured data source.
      • In the Timeout (milliseconds) property, specify the time (in milliseconds) that the node waits for the waits for the LoopBack connector to process the operation.

      These properties can be overridden dynamically in the flow, as described in Using local environment variables with LoopBackRequest nodes.

    2. On the Results tab, set the Output data location property to control where the JSON object that contains the count of the deleted records will be placed in the output message tree.
    For more information, see LoopBackRequest node.
  2. Ensure that the ID of the record that you want to delete is set in the LocalEnvironment.Destination.Loopback.Request.id local environment variable.
    You can also delete records by specifying values in the LocalEnvironment.Destination.Loopback.Request.externalId and LocalEnvironment.Destination.Loopback.Request.externalIdName local environment variables.
  3. Send the required message through the flow to the LoopBack application.
    If the delete operation is successful, the output tree will contain the count of the deleted records.
  4. Go to your account in the backend data source to verify that the record has been deleted successfully.
    You can also check the activity log for additional information about events related to the LoopBackRequest node. If the Loopback operation was not successful, the node reports by raising an exception with a BIP message that might include an error returned from the installed LoopBack connector. If the failure terminal is connected, the node will propagate the exception list to it, otherwise the flow will roll back.