# Is it possible to make changes to a database entry in the plugin's update function?

**URL:** <https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536>\
**Category:** Need help\
**Created:** [March 13, 2023, 8:58pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536 "2023-03-13T20:58:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdcuru97](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sdcuru97/32/165281_2.png) [@sdcuru97](https://forum.bubble.io/u/sdcuru97)\
**Post date:** [March 13, 2023, 8:58pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/1 "2023-03-13T20:58:57Z")

</div>

For those of you wondering why would i need that when it can be achieved in the page editor, well…

**Ever since I started using bubble i’ve had this problem (need help):**

I cannot find a way to dynamically select a field of any given data type without conditionals.

For example:

Lets say I want to have a dropdown that displays the name of the fields of the User data type so that the choices are **name** or **last\_name** (or whichever fields there are in the data type).  
_I could only achieve that with a plugin._ 😨

Now imagine that I wanted to either change the **name** or the **last\_name** and I wanted to select which one to change with the Dropdown.  
I would set a workflow to make changes to a thing, set that thing to be Current User and then the expression I would use, _if it existed_, would be something like _Dropdown A’s value = newString_ with Dropdown A’s value being the field i would be changing and newString being the new value.

For this case, since there are only two possible fields (name or last\_name), a simple conditional works just fine. But when the amount of possible fields increases, using conditionals is just repeating the same thing over and over and i know that solving this with any sort of programming language is a one-liner. In Javascript it would look something like this:  
User[“DropdownAs value”] = newString

For what i’ve researched this is not possible to do in the page editor.  
Could this be achieved within a plugin?

I hope i explained myself correctly 🙃

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [March 13, 2023, 9:02pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/2 "2023-03-13T21:02:59Z")

</div>

To answer the question posed in the headline: No it is not possible to make changes to nor create nor destroy Things in a plugin. This can only be done by the Bubble programmer (much is the pity).

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [March 13, 2023, 9:10pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/3 "2023-03-13T21:10:05Z")

</div>

Now, as for your other question: There is no notation in the expression builder that lets you specify a Thing’s field using a string (or anything else for that matter). You must construct, by pointing and clicking, `some_thing's field`. As you note, this is at times very tiresome.

---

<div class="post-metadata">

**Author:** ![eldad1](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/eldad1/32/151670_2.png) [@eldad1](https://forum.bubble.io/u/eldad1)\
**Post date:** [March 13, 2023, 9:20pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/4 "2023-03-13T21:20:14Z")

</div>

You could do something like this in your workflow, so all the fields are mapped but only the field selected in the dropdown is updated in one step

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/4/9/49fd3e77e7696cc5dd27d0e0719accd0f88ec2a3.png)

If you really want to use a plugin, you could create a data API (backend flow) and then call that API from your plugin (with Fetch or HttpsRequest)

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [March 13, 2023, 9:28pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/5 "2023-03-13T21:28:21Z")

</div>

Yep, that’s about as dynamic as you could have that in Bubble, @eldad1! For clarity, @sdcuru97, note that what @eldad1’s Make changes step does in fact make changes to all of the fields selected there, it’s just that the “updated” values will only be different for the field specified as the one to change.

---

<div class="post-metadata">

**Author:** ![sdcuru97](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sdcuru97/32/165281_2.png) [@sdcuru97](https://forum.bubble.io/u/sdcuru97)\
**Post date:** [March 13, 2023, 9:30pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/6 "2023-03-13T21:30:32Z")

</div>

Wow man! never thought of that!

While it is still more complicated than i think it should be i find this to be a great approach!

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![sdcuru97](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/sdcuru97/32/165281_2.png) [@sdcuru97](https://forum.bubble.io/u/sdcuru97)\
**Post date:** [March 13, 2023, 9:35pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/7 "2023-03-13T21:35:10Z")

</div>

Continuing the discussion from [Is it possible to make changes to a database entry in the plugin's update function?](http://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/5):

Yes, still a lot of conditional formatting to do but much better than using a million steps with a million “Only whens”.

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [March 13, 2023, 11:24pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/8 "2023-03-13T23:24:20Z")

</div>

> I cannot find a way to dynamically select a field of any given data type without conditionals.

@sdcuru97

Don’t forget about using the Data API… (Make changes to a Thing by ID)

You can set the ‘field to change’ dynamically from a dropdown using that.

1 workflow action, no conditions, just one value for the field name, and one for the field value.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [May 22, 2023, 8:59pm UTC](https://forum.bubble.io/t/is-it-possible-to-make-changes-to-a-database-entry-in-the-plugins-update-function/251536/9 "2023-05-22T20:59:47Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
