Checking true conditions in the server without loading them onto page

Hi guys!
How do I achieve this using UI builder?

I have made this question before but it simply did not work.
The logic is, if the current user registered to an event, there should be a “remove” button.
If current user has not registered for an event, there should be a register button.
How can I check in real time if the current user has registered or not to an activity?
For example:
The user can simply click a button to register or click a button to remove the register without reloading the page.

Is the information whether the user is registered to an activity available on the client side? Do you load that information from the server? if you do, where is that information available? Is it a part of the current user object?

No, its registered on the Database only. I dont know if I should load the information or not? How to properly load it as well since I dont want to display other “users” objectIDs.

If you need to make a decision in the UI then the information needs to be loaded into the UI.

Then I got 3 questions.

  1. Is it not dangerous? I mean, all the user objectId’s are loaded into the UI…

  2. Is it not possible to do a server sided function like:
    Check if current user objectId is stored in Event registered Users,
    if true change Button color and label,
    if false do nothing.

Like that I can keep the database structure and all the other users objectId’s are safe.
image

  1. Another approach I though about is to store the event objectId on the user instead, but I think this will create scalability problems on the run.

image

In this case the only thing loaded is the current user information so it’s not a problem. How should I approach this?

Hello @Rafael_Cunha!

If you don’t want to retrieve the entire object from the database, you can use the “Get Object Count” block. In this way you can find out if a user is registered for a certain event.

image

Regards,
Alexander