"Low Stock" alert

Hi all,

I’m creating an inventory management app, and i’m trying to have an alert pop up when the stock of a certain item falls below a certain number. I have a data type called “stock item” which has fields including “quantity” and “restock at”.

when the quantity is equal to or below the “restock at” of that item, i want an alert to come up telling the user they need to restock the item. I would also like that item to then be shown in a group on the home page, along with other items that are running low.

I cannot figure how to populate this repeating group correctly - I am trying to add a constraint where it only shows items when the “quantity” is less than or equal to that item’s “restock at” value, but bubble will not let me do this.

Can anyone advise how i can make this happen?

Cheers,

Tom.

attached is a screenshot of the home page of the app, and also a custom event i was trying to trigger to maybe make this happen.

Hi there, @tom3… for the repeating group that shows items where the quantity is less than or equal to the restock value, you could get those items by using an advanced filter that looks like this…

That being said, you probably shouldn’t go that route because advanced filters are not very efficient/performant because the filter is done on the client side after all of the possible records have been returned.

So, you might want to consider adding another field to your Stock Item data type, and that field (let’s call it stock low) could have a type of yes/no. Then, any time the quantity of an item is reduced, you could set the item’s stock low field to yes only when the item’s quantity is less than or equal to its restock at value. With that setup in place, you could easily get the appropriate items to show up in the repeating group by searching for items where the stock low field is yes. Make sense?

As for the alert, it depends on how you are defining “alert,” but if you add the stock low field that I mentioned above and you have a workflow that sets it to yes as needed, you could have another step in the workflow that shows an alert only when the result of the step that sets the stock low field to yes is not empty.

Oh, and it probably goes without saying that, with what I have proposed above, you would need a workflow step to set an item’s stock low field to no when the stock of that item is replenished, but I didn’t think it could hurt to call that out.

Anyway, I hope this response is helpful, even if it’s just food for thought.

Best…
Mike

Hi @mikeloc , thanks for your detailed response. The idea of creating a “stock low” field would definitely solve the problem, so i have created this field. I’m not sure where to put the workflow that updates the field? should it be triggered every time an item’s stock is changed?

cheers,
tom

My pleasure, @tom3… and yes, you will need to have a workflow step that potentially (based on an only when condition) changes that field to yes or no every time an item’s stock is changed.

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