You can’t save directly to DB. You need to return data into a state and user can choose to save data or not to DB using Bubble feature (create/make change to a thing).

So you need to create state (long/lat) in the plugin, use instance.publishState() function, after you can use instance.triggerEvent() function to trigger a workflow (you need to create an event in the event section).

Trigger 'location_changed' event
instance.publishState('lat',location.lat()) 
instance.publishState('long',location.long()) 
instance.triggerEvent('location_changed');
1 Like