Removing User's Products from search

Hi!

I’m building a marketplace and have Users and Products data types.
In Products I have an Online status (yes/no).
In Users I have a Blocked option (yes/no).

In case a User violates the rules I will change his Blocked to YES.

QUESTION:
How to automate all his product’s Online to NO if the Blocked is YES? I will change his Blocked status manually in the database settings.

Tnx.

You can simply use a database trigger for this.

When User Before’s Blocked is No and User Now’s Blocked is Yes

Then just use a ‘make changes to a list of things’ action to change all Products created by that user to Online: No.

1 Like

Thank you! How to set up that trigger? :frowning: On page load?

You can set up a database trigger in the backend workflow area.

If you don’t have that option, go to the Settings >> API tab and check the box to enable backend workflows.

After you set up the trigger on the backend, you should be good to go because the trigger is watching the specified thing, and when the thing changes in the specified manner (value before change vs. value now), the trigger fires.

Edit: if a visual would help, the trigger will look something like this.

2 Likes

Hi! Thank you. Tried it but either I misconfigured or it should be configured in other way :frowning:

Will this be pricey re: new workload units? Would a filtered search although slower be easier in the units?

I didn’t succeed in adding this filter to sort the repeating group. Tried it this or that way, it gives an issue.:confused:

It would be something like
Search for products:filtered:advanced this products users blocked toggle = yes

What’s the issue?

I assume you mean, loading the entire database to the browser first, then applying a filter client-side?

In which case, that would be a lot worse (in both performance AND WU) and not recommended - I’m not sure why you’d want to to that anyway.

Ok, so! I managed to make this happen with the database trigger. Thanks for your help.!

The reason it wasn’t working in the begginning is that I forgot to add a filter Online=“yes” to my repeating group settings. :slight_smile:

1 Like

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