# Change database when condition is true

**URL:** <https://forum.bubble.io/t/change-database-when-condition-is-true/234086>\
**Category:** Database\
**Created:** [November 24, 2022, 11:09pm UTC](https://forum.bubble.io/t/change-database-when-condition-is-true/234086 "2022-11-24T23:09:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mikeloc](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mikeloc/32/93001_2.png) [@mikeloc](https://forum.bubble.io/u/mikeloc)\
**Post date:** [November 24, 2022, 11:48pm UTC](https://forum.bubble.io/t/change-database-when-condition-is-true/234086/2 "2022-11-24T23:48:33Z")

</div>

Hi there, @felipe.kluk… so, first, we will assume you’re on a paid plan based on the advice you were given in the [first thread](http://forum.bubble.io/t/changing-data-dynamically-in-the-database/233818) where you asked this question. Given that you have access to backend workflows, here is an example that should help you get down a good path.

Create a backend workflow that looks something like this…

 ![backend](https://us1.discourse-cdn.com/bubble/original/3X/3/e/3e2e525e80c2b78503677c4e00d6536891ff9810.png)

The backend workflow will have an action that looks something like this…

 ![action](https://us1.discourse-cdn.com/bubble/original/3X/e/f/efb3e1020014e06742134339e1b97b04041d35c1.png)

Note that I have a `status` field on the `Invoice` data type, and that field is linked to an option set that defines the different statuses for an invoice. Also note that we are only setting an invoice’s status to overdue if the invoice is not marked as paid.

Finally, when an invoice is created, have the last step in the workflow schedule the backend workflow like this…

 ![frontend](https://us1.discourse-cdn.com/bubble/original/3X/6/1/6166195f71575dd815d99b3f895e930d08665cdf.png)

Hope this helps.

Best…  
Mike

---

_[View the full topic](https://forum.bubble.io/t/change-database-when-condition-is-true/234086)._
