Post chnages to database from Javascript

I need to push changes to the database back from users of my plugin element.
Is there a hidden Javascript API somewhere that might have database calls? Im fine with SQL if theres a way to issue it.

There isn’t any way to directly make changes to the DB with JS from a plugin.

Try one of the following:

  1. Creating an event that is fired when some condition is true. Then, run a workflow in Bubble that makes changes to the DB when that event is fired.
  2. Setting a state on the plugin element, and then using a “Do when condition is true” workflow on the Bubble page to listen for the condition where the state is updated. image

This plugin’s “Javascript to Bubble” element has some concise code that could help you see how to do this: Bubble Plugin Editor - Toolbox

Thanks, I think i have it figured out using a workflow.

Right now Im trying to figure out how to get a database record back from its id in a js callback to put it in the the state . I think I remember seeing a big post about how to access bubble data in Javascript but Im having trouble finding it again…

Found it, but this wasn’t in it. And having no luck googling or looking at the docs for either instance or context?

Surely there must be a way to get a record back by its id?

This might put you on the right path…

get_object_from_id() & get_object_from_ids()

Thanks. based on that it sounds like you actually have to write a webAPI call, that there are no utility functions for it.

Which is a bit scary as it implies that the web API to data is open to the net…

By default it’s open. You have the privacy rules and conditional statements to handle the logic.