Change Database field when another field is changed

Hello @James_Hereford,

You’re correct that a generated column won’t fit your needs for this scenario. Instead, you can achieve this by using a beforeUpdate event handler.

Here’s how you can set it up:

  1. Create a beforeUpdate Event Handler: In the Backendless Console, go to the “Cloud Code” section and create a beforeUpdate event handler for your table.
  2. Retrieve the Existing Record: Use the event handler to retrieve the existing record from the database by its objectId. This lets you access the previous value of the Notes field.
  3. Compare the Notes Field: Compare the existing value of the Notes field with the new value that’s being saved. If the values differ, it means the Notes field has been updated.
  4. Update the isNewNote Field: If the Notes field has changed, set the isNewNote field to true.

This approach will ensure that every time the Notes field is modified, the isNewNote field is updated to true.

Here’s how this logic might look:

Please note that the Event Handler should be of the Blocking type:

For more information about how Event Handlers work, please refer to the documentation: Event Handlers Documentation.

Let me know if you need any further assistance!

Regards,
Stanislaw