Skip to main content

Using Subform Records to Delete Form Records

This article explains how to use Automations Pro to automatically delete records from another form when records are deleted from a Subform field.


When to Use this Feature?

In customer management, customer and contact information needs to be maintained automatically. For example, when one or more contacts are deleted from the Customer form, the corresponding contact records in the Contact form should also be deleted.


How is it Designed?

  1. Create a Contact form to store the basic information of all contacts. The form must include the Customer Number and Contact Number fields.

  2. Create a Customer form and add a subform named Contact Details. The form is used to enter customers’ basic information and the information of all contacts associated with each customer.

  3. Create an Automations Pro automation. When contacts are deleted from the Customer form, the automation automatically deletes the corresponding records from the Contact form.


What does it Look Like?

1. A customer record with the Customer Number KH0001 has already been added to the Customer form. Its Contact Details subform contains three contact records with the following Contact Numbers:LXR0001,LXR0002,LXR0003.

2. The Contact form also contains three records. Their Customer Number is KH0001, and their Contact Numbers are LXR0001, LXR0002, and LXR0003.

The records are shown below:

3. In the Customer form, delete the two contact records whose Contact Numbers are LXR0002 and LXR0003 from the Contact Details subform.

The corresponding records in the Contact form will then be deleted automatically, as shown below:


How to Set up?

Step 1 Preparing the forms

This case uses data from the following two forms:

1. Customer

Create a form named Customer and add a subform named Contact Details. Configure the fields as follows:

Field Name

Field Type

Customer ID

Serial No.

Customer Name

Single Line

Lead Source

Single Select

Customer Status

Single Select

Customer Tier

Single Select

Industry

Single Select

Customer Details

Multi Line

Contact Details

SubForm

Contact Details.Contact ID

SubForm - Single Line

Contact Details.Name

SubForm - Single Line

Contact Details.Contact Info

SubForm - Single Line

Contact Details.Department

SubForm - Single Line

Contact Details.Title

SubForm - Single Line

2. Contact

Create a form named Contact and configure the fields as follows:

Field Name

Field Type

Select Customer

Select Data

Customer ID

Single Line, populated through Select Data

Customer Name

Single Line, populated through Select Data

Contact ID

Serial No.

Contact Name

Single Line

Department

Single Line

Title

Single Line

Contact Info

Single Line

Owner

Member

Contact Details

Multi Line

Step 2 Creating an Automations Pro

Go to Extension and create an Automations Pro automation named Synchronize Contact Deletions. Set the trigger type to Form Trigger with the Customer form as the triggering form.

Step 3 Setting the Trigger Node

Select the Trigger node and choose Update record as the trigger event.

When a contact is deleted from the Customer form, the customer record is updated and Automations Pro is triggered.

Step 4 Deleting the Corresponding Contact Records

Use a Delete Record node to find and delete the corresponding records from the Contact form based on the Customer ID and Contact ID in the trigger data.

1. Adding a Delete Record Node

Add a Delete Record node under the Trigger node.

2. Configuring the Delete Record Node

Rename the node to "Delete Corresponding Contact Records" and complete the following steps:

  • Under Delete, select "Decord in the form" and set the target form to "Contact".

  • Add the following conditions to filter the records to be deleted:

    • Customer ID equals to any Trigger Data -> Customer ID

    • Contact ID does not equal to any Trigger Data -> Contact Details.Contact ID

Step 5 Saving and Enabling the Automation

After completing all the settings, click Save & Enable to put the Automations Pro automation into use.


How Do the Deletion Conditions Work?

1. Before deletion, records in the Customer form are linked to the Contact form via the Contact Number field. Each row in the Contact Details subform corresponds to one record in the Contact form.

2. After one or more contacts are removed from the Customer form, their Contact Numbers can no longer be matched with records in the Contact form.

As a result, any records in the Contact form that no longer have a matching Contact Number in the Contact Details subform should be deleted.

So the Deletion condition is: Contact ID does not equal to any Trigger Data -> Contact Details.Contact ID

Did this answer your question?