Backend workflow?

Hi all,

I’m building a food marketplace. I wanted to put the listing down automatically when it hits the expiry date or when it runs out of stock. So far the way I did it was in the page’s workflow and that’s probably why the listing is not down until the page refresh itself. So, should I achieve it with backend workflow instead? If it’s not too much trouble, will be good to have a few tips on how to get this done as well. also, do I need to be in a professional plan for this backend workflow feature?

Create a backend workflow to make whatever changes you need to the listing…

Schedule that workflow to run on the expiry date of the listing…

Also, use a database trigger event to trigger it when the stock count hits 0

(no, you don’t need to be on the Professional plan to run backend workflows… any paid plan has access to these.

Thank you so much, @adamhholmes !!

I have quick follow up questions, if you don’t mind. It says that personal plan recurring workflow is run “monthly”, whereas professional plan recurring workflow is run “daily”. What does recurring workflow actually mean? also, will I need it to be daily to get the discussed functionality to work?

Yes, on the Personal plan you can only run a Recurring Workflow monthly.

But that’s got nothing to do with anything here. You don’t want to use a recurring workflow for this.

Just regular backend workflows and triggers.

1 Like

Hi @adamhholmes , sorry to keep bothering you on this. But would you mind to walk we through how I could set up the backend workflow when the expiry date hits and when the it’s out of stock? I’m quite confused and can’t find the solution/ example online. I assume I’m not setting up in the individual page, but rather in the “backend workflow” only.

Screenshots attached are the workflow for the out of stock. I think I did something wrong there, because when the stock hit zero, nothing happened. The listing is still there and not taken down.

I don’t have a clue on how to do the scheduled workflow for the expiry date.

I’m not entirely sure what the condition on your database trigger event means (it might make sense to you)…

And without knowing more specifics about your app, I can only make suggestions…

But, for the Out of Stock workflow, I would have thought the following condition would be the one you want to use:

when Food Listing Before's Availably > 0 and Food Listing Now's Availability is 0

And for the expiry date workflow, you just need to create another backend event (just a regular API workflow) to change the Published status to ‘No’, and schedule that (from the front end) to run on the expiry data, whenever a new Listing is created.

Obviously, if you change the expiry data of a listing, then you’ll need to cancel the original workflow, and reschedule a new one. So for that you’ll ned to store the workflow ID somewhere (e.g. on the listing datatype).

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