A thing is modified event properties

A thing is modified events execute server-side when a specific change happens in the database, regardless of how the change was made.

This core reference entry is suited for advanced-level builders.

Learn more about experience levels.

The A thing is modified event is triggered when data in the database is changed. It is configured in the backend workflow editor.

When a thing of the specified data type is modified, Bubble evaluates the Only when... condition. If the condition returns yes, the workflow runs.

First, set the Type of data on the event to define which data type should be monitored. Then, use the Only when... field to specify which changes should trigger the event.

A thing is modified events run for any change to the data, regardless of whether the change comes from a workflow, an API call, or a manual edit in the editor.

Properties

Event name

Enter the name of the workflow.

Type

An a thing is modified event watches a certain type of thing for changes. Define the type here.

Timezone selection

Override the backend trigger's timezone by setting an alternative timezone with a static or dynamic choice. For this setting to be available you must first enable the setting Enable timezone override controls in your app's general settings.

Time zone selection
Description
Sub-properties

Timezone where event was scheduled

Uses the time zone reported from the browser of the user setting the event.

Static choice

Set a static time zone from a dropdown.

Time zone ID: sets the time zone ID you want to use.

Dynamic choice

Set a time zone from a dynamic expression.

Dynamic time zone: sets the time zone ID using a dynamic expression. Must match the IANA time zone format (also known as the tz database or Olson database format).

Data sources

Thing before change and thing now

When working with a thing is modified events, two unique data sources become available:

  • Thing before change

  • Thing now

"Thing" will change to match the type of thing you are working with. You can reference these two data sources in the condition on the event itself, and in any actions within the A thing is modified event workflow.

Methods

Triggering when a specific field changes

The event can be configured to trigger only when a specific field changes by using dynamic expressions and the data sources provided by the A thing is modified event.

These data sources represent the state of the thing before the change and after the change. By comparing fields between the two, you can detect and target changes to specific fields.

Example 1: Price change

In this example, we have a data type Product with a field Price. We want the event to trigger when a Product is modified, but only if the change affects the price.

To do this, compare the value of Price before and after the change. If the two values are different, it means the price has been updated, and the event can run.

Example 2: Price increase

In this example, we still have a data type Product with a field Price. We want the event to trigger when a Product is modified, but only if the price has increased.

To do this, compare the value of Price before and after the change. If the value after the change is greater than the value before the change, the price has increased and the event can run.

Triggering when a thing is created or deleted

Triggers are also fired when a thing is created or deleted.

Created

If a thing is created, its thing before change data source will return an empty value, since there is no former thing to refer to. To check whether a thing was created, you can use the condition Thing before change is empty.

Checking if a new database thing was created before triggering the "A thing is modified" event.
The condition checks whether Product before change is empty. If it is, the expression returns yes, indicating that a new Product has been created.

Deleted

If a thing is deleted, its thing now data source will return an empty value, since the change made to the thing was to remove it altogether. To check whether a thing was deleted, you can use the condition Thing now is empty.

Precautions

There are a few important caveats and considerations to keep in mind when using A thing is modified events.

Multiple changes in one workflow

If one workflow modifies a thing multiple times, A thing is modified events will only triggers once:

  • Thing before change will reflect the data in the thing before any changes were made, and Thing now will reflect the data in the thing after the last change has happened.

Privacy rules

The following guidelines are important to note regarding privacy rules:

  • You can refer the Current user in an action in the a thing is modified event workflow

  • Unlike other workflows, a thing is modified events run with full administrative privileges

    • This means privacy rules are not applied to any actions and expressions within that workflow

    • Searches performed within the workflow will return all results, not just those the current user is allowed to see. Use search constraints to limit the data returned.

Triggers cannot kick of other triggers

A a thing is modified event cannot kick off a second triggers:

  • if data is modified by a workflow initiated by a trigger, Bubble does not check to see if those modifications are eligible for initiating other trigger events.

  • You can get around this by scheduling a separate custom event or API workflow from the original a thing is modified event workflow. Any database change made by this second workflow will trigger as expected.

    • This method will consume more workload

    • Also, while sometimes necessary, it should be used with caution, since it can easily set up a cascade or loop of workflows that can spend significant resources and possible lead to data corruption

Data source availability

The Only when... condition can only use Thing now and Thing Before Change instead of the full list of Bubble data sources. The full list of data sources are available in the actions kicked off by the trigger.

Note: If you have more than 20 A thing is modified events that kick off at once, the remaining triggers will be scheduled to protect your app's infrastructure from consuming too much memory.

Last updated

Was this helpful?