How do I set a field when creating a new thing?

I would like to create a new thing (a “session” in my case) and give a field of this thing the value of a parameter in the URL (user ID).

So for example:
URL = […] Bubble | Build Powerful Full-Stack Apps Without Code1682251140663x129140871202336300

The new session should get a field (also called “userid”) with value 1682251140663x129140871202336300
Which should be displayed here:

However, when I am working on the workflow, I get this error:

What am I doing wrong here?

If you’re using a Make Changes to a thing workflow action, you need to define the Thing to change where it says ‘Thing to change’

You can only Change things in the database, so the thing you define must be a database entry.

In your screenshot you’re trying to change a unique ID - which is a text, not a Thing.

In any case, I’m not sure why you’re trying to make changes to the Thing you just created in the previous workflow step (aside from being unnecessary, it will cost you twice as much in WUs).

Just set the relevant field in the Create A New Thing action

Although, is it really good idea to store the User’s Unique ID as a text? rather than storing the actual User?

Thanks for your reply.

The reason why I want to “copy” the user id to a field in the Session datatype is the following:
I want to mark sessions, so they are always traceable. I am working on an app for companies and their end users. Each end user can have several sessions in the app. These end users may not see each others sessions, so that is why i want to mark them (user X may only see sessions marked with X).

But I am learning as I go, so there may be better solutions.

Let me explain the full concept:
The app is for several (very small) companies, that each have a few users. For each users there can be one or more sessions. I am looking for ways to seperate everything in the database. The companies may not see eachothers users or sessions, and within a company, -as stated before- user may not see eachothers sessions (or other info). One company however, may see all their own users and their sessions.

My plan was to mark everything, starting with the sessions. Are there better ways?

EDIT: I didn’t know I could set fields ON the create a thing step.
My initial problem is solved! However, if you have some tips about handling the above in general (properly separating data)…

Good to see your first issue is solved…

But it would make more sense to have a User field on the Session datatype, and store the actual User there (rather than using a text field).

Hi Woezel,
Ik ben mee eens met Adam. Het is handig om een ​​nieuw field te maken in het datatype “sessie” met naam user_id en content type User. In uw create a thing-workflow maak u gewoon de user_id de current user. Als u in de toekomst meer user informatie nodig hebt met betrekking tot de sessie, kunt u gewoon naar het user_id field kijken. U hoeft bijvoorbeeld niet te zoeken naar een User met User-ID dat is gelijk aan de User-ID van deze sessie. In plaats daarvan zou je gewoon de user_id van deze sessie ophalen.

Cheers :slight_smile: