Creating slugs with external database

Is there an explanation on how to use slugs from an external database inside bubble??

Can you be more specific on what you are trying to accomplish? What type of external database?

trying to use a name as a slug but the data is coming from an external database…

@JohnT

Are you storing data to bubble DB?

Ankur@ Nocodetalks
Looking for a Bubble Coach? Check out here

Couple of ways to do this:

  1. expose an API endpoint on your backend workflows that accepts the thing’s id and new slug value, and then assigns that slug to the thing with that id.
    Then call that API from your external server.

  2. Easier:
    a. Export this DB thing as a CSV, then add a column called slug_temp where you put in all the new slug values from your other DB (should be easy to do since you can export CSV from most DBs).
    b. Modify your DB via a CSV upload using this CSV and add the new field (slug_temp) on your DB.
    c. Then set up a backend API WF to take a thing and run an action on it to set the slug as the value in this slug_temp field.
    d. Now go to your DB, make all things of this type visible and run a Bulk action on them, select this API WF you created and it will do the job.
    e. You can remove the slug_temp field once this is done.

Hope this helps!

2 Likes

doesn’t work for what I am trying to do.

I already have a slug stored within my external database and would simply just like to send that slug to bubble to be displayed as the slug on the page that the user is viewing.

For example;

user is viewing their own profile, I would grab the user data via API (slug included) then display said slug as slug via bubble.

I have the slug created the way I want on the backend, I just need to display it.

Ah, I see
From what I understand though, Bubble uses the thing’s slug field for this internally.
You could grab the new slug, write it to the corresponding DB row temporarily and then render the page with that URL. But there isn’t a native solution I can think of.

This is a key point to consider before outsourcing the backend to other API providers.

Also the set slug workflow is incredibly slow for some reason. Just a heads up. Had to do that for 40k records and the results were astonishingly bad. What would take mysql a few seconds took bubble a day to run, and it kicked out of the loop (randomly) after about every 100-200ish records.

It also doesn’t inform you when this happens, the loop just stops running. I devised a way to get it done, by using the last modified date to sort the search that loaded the loop.

I had to manually restart the loop about 200 times and I had to do the process 3 times to get it right. I hope you don’t have a lot of records.

1 Like

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