Filter out a data type's records based on one value but system wide

We use Bubble as a CRM, and I’ve been thinking of changing things around so that instead of allowing users to delete records, I’ll instead add a “Is Deleted” field with a yes/no value. When they “delete” a record, it just changes it to “yes.” Then on repeating groups and so on I’d just set it to always show where “Is Deleted = no.”

Just wondering though before I go and add this to tons of page layouts, repeating groups, etc, if there’s any way to do it system wide. Like somehow never include “Is Deleted = yes” in any view at all. I’m guessing not since not sure how that would work but just wanted to check before I spend half the day changing my search criteria to “Is Deleted = no” on probably 50+ places!

Thanks!

I’m not certain about the performance aspects of the following (I don’t actually think there’d be much of any, but only Bubble could tell us for sure), but one very clever way to do this is using Privacy Rules…

If you have a data type with a “Deleted” field (don’t call it “Is Deleted”, please, that leads to ugly looking expressions, right?), you can set Privacy Rules as in the image below.

  1. Create a rule for the “hidden” things: This rule should have no permissions at all (effectively keeping the object from ever being found in searches or downloaded to the browser). Because we need the rule to resolve to a match based on User, we write a funny-looking privacy rule (This Job’s Deleted is “yes” and Current User is not empty), as shown in the image.

  2. Create a rule for the “non hidden” things: This rule effectively replaces the “everyone else” rule and is basically the opposite of rule 1.

  3. Set the “Everyone else” permissions to have no permissions at all (as in #1).

The only real drawback I can see to this is if your data type has other privacy roles you’d have to modify all of them similarly. But that’s probably a lot less work than changing your pages everywhere!

Note: I’m not sure what @josh would have to say about this slightly unorthodox application of Privacy Rules, but it seems like a valid application to me. The point of Privacy Rules is to keep certain data from winding up in a Search for certain types of roles.

Here are the settings I used in my demo:

And, indeed, this works:

Here are two “Job” objects that have the Deleted flag set:

And a search for all Jobs shows that neither of those Jobs (“Emergency Telecommunications Dispatcher” and “Vacuum Cleaner Repair Person”) appears in the resulting list:

Nifty!

1 Like