Forum Documentation Showcase Pricing Learn more

I need help with making a countdown system

Basically when a user creates a community and it shows them a amount of days that counts down. When it reaches 0 then it will show a popup that there community has expired.

You can use a recurring API workflow.

  1. Make sure you have an integer field on your community data object called days. Whenever you create a community, set this, or else set a default value in your DB.

  2. Create a recurring event in your API workflows page. Make it of thing type: community image

  3. Attach to it a make changes to a thing action which takes the days field on the current workflow’s community and subtracts 1 from it (current workflow’s days - 1).

  4. Add to the end of this workflow a Set/cancel a recurring event action which runs only when current workflow’s community’s days = 0 and have it set the frequency to none (this will stop the countdown when it hits 0)

  5. On your workflow which creates a new community, add a Set/cancel a recurring event action and choose the event you created in step 2. Set the workflow thing to be the community created earlier in your workflow, and set the frequency to daily.

  6. Add a condition wherever you are showing the community to show your popup on page load only when the community’s days = 0

its like when a user create a community it will set a amount of days and when it reaches 0 it will display a popup.

Do this - much simpler than what I first suggested.

  1. When you create a community, choose a date in the future when you would like it to expire and save this to the community data type as a date field called: expiry date (or some equivalent)
  2. Wherever you display the countdown, use this expression: current date/time - community’s expiry date:formatted as days * -1 (The multiplying by -1 is to turn the result to a positive integer). This will show the number of days remaining.
  3. Wherever you display the popup, you need to display it on page load ONLY WHEN the current date/time > community’s expiry date. This will then show whenever the community has expired
1 Like

I did that and now it’s counting up for some reason. I think I did it correct. @MattN

is it correct?

I don’t see any issues with your popup workflow, although I don’t see why you would want to change the expiry date.

For the countdown, the formula I said before should work. Only thing I might add is a :ceiling in the expression so you don’t get any decimal points in the countdown.

Here is an example of the expression in action.