Do database searches within a workflow

Hi. I’ll preface this by saying I’m not super knowledgeable when it comes to bubble, so what I’m trying to do might not even be possible.

Basically, I’m trying to create an internal workflow to allow my app to safely connect to cPanel’s API and create e-mail accounts for my users.

In my mind, the whole process should go like this:

  1. User fills a form with desired email name and password

  2. This triggers an internal workflow (and sends the form fields + domain + ‘user id’ as data)

  3. The internal workflow searches the ‘Website’ database table using the ‘domain’ value as a constraint and gets the server_id value (which is a foreign key) in that table

  4. The internal workflow uses that server_id to do a new search, this time in the ‘Servers’ table (which is private) and gets the hostname AND access hash values for that particular server

  5. All that data is then used to authenticate and trigger an external API (with POST request) that will create the email account

  6. If the response indicates a success, a ‘success’ popup should appear for the user

    6b. If the response indicates an error, an ‘error’ popup should appear

  7. If it was a success, we add a new item to the ‘Email’ database table corresponding to the created email


The problem is, I have no idea how to do steps 3 and 4 within a workflow in bubble. In fact, I’m not even sure if that’s possible?

So my question is: Can I take specific data that was sent to a workflow and use it as a constraint to do database searches to get more data that i’ll use - all within a workflow?

And what are my options when it comes to steps 6a and 6b?

Thanks in advance for the help, and sorry if that was confusing.

Yes, lets say one of your API call’s parameters is hostname, you would do this data source:

Do a search for Server, add the constraint server_id = Do a search for Website, inside that search add the constraint domain = [your domain input]'s value then after the Website search do :first item's server_id, then after the Server search do :first item's hostname

Then copy/paste the expression for your “hash” parameter then change the field to its hash.

Have a “Show an element” action, show the Error popup, but with the condition Result from step 1 's message is "error" (if your API call is step 1, and whatever field/message it is)

I would probably make a new Custom Event for the success, trigger the custom event but with the condition Result from step 1 's message is "success"

Then your actions inside the custom event would show the success popup, as well as a “Create a new thing” action, creating a new Email for your Email database table.

1 Like

Thank you very much, Tyler. That makes a lot of sense and solved it perfectly.

Also, using Custom Events is such an elegant solution that I would’ve never have thought of.

A thousand kudos to you!

1 Like