Privacy Rules Can Not Access Unique ID

When setting up privacy rules it seems like the unique ID of the ‘thing’ is not accessible to be used as the condition for setting up a privacy rule…can’t do a search either.

How to get around this issue? I’ve got a data type that saves the users unique id rather than a related field to the user and I don’t want to have to change all the workflows, change the data structure to accommodate.

In your “Create user” workflow (or a DB Trigger) you could probably copy the unique id to a new field. And then in your privacy settings you could refer the new field.

1 Like

So create a new field on the user data type that is ‘unique id text’ so that I would have that unique id built in field saved twice on the same data type…that is a decent workaround.

May I ask, why do you relate id’s and not the user objects?

Built a notification system…when building it, I was under the impression that using a related field would cause all of the related fields data to be ‘loaded’ when a search was performed.

My understanding now is that when you have a related data field, the data of that related field is not ‘loaded’ and doesn’t slow down a search any more than another text field might, because the related field is actually only ‘loading’ the unique ID of that related field so the amount of data that it ‘attaches’ that could affect a search is only equal to 32 characters of text.

Is that your understanding of how a related field may affect the performance of a search of the data type with a related field?

Yes, I am pretty sure. When you relate fields like that, Bubble do perform the search on id fields.

Not sure of what you mean by “loaded” but if you are refering to the web page load then I can say that the page loads the fields you have requested in your page design and some buffer/meta data.

Let say you display a car thing on your page. And the car thing is related to a user. Load the page in your browser and view the page source. You will see that only your car thing fields (that you requested) is loaded, not the user fields.

Does that make sense?

My meaning was if I have a data type of car and another data type of dealership and I wanted to relate the dealership to the car, I might on the car datatype have a related field of dealership.

So if a user were to search for cars, when loading the data for the car it also loads the data for the related dealership even if you are not ‘calling’ for dealership data.

But I think it is not ‘loading’ the related dealership data until you request it to, and at that point Bubble searches for dealerships and constrains by the Unique ID of the related dealership on that car datatype since the only thing Bubble is actually storing on the car datatype for the related field of dealership is the dealership unique id.

To sum it up. I would drop the work around and definitely go for referencing the “thing”, not the unique id itself.

1 Like

I was just experiencing the same thing, and this post led me to believe that the problem is that Bubble doesn’t let you search by Unique ID. This red herring made me lose valuable time.

Let me clarify for everyone who comes after:

YOU CAN JUST SEARCH BY UNIQUE ID. All you have to do is check the box in privacy rules to allow searching

If your search by ID is not working and you have that box checked, you have a different issue that has nothing to do with privacy settings.

Hopefully this saves you time in your debugging.