Schedule feature

default discord avatar
gabrielsantos
7 months ago
3

Hello there.



We're proposing PayloadCMS to a customer, and I'm in charge of make some PoCs based on their scenarios I'm stuck in one of these that is to make schedule system to scheduling posts changing its status publish and unpublished given a date.



Is there a solution for this case?


Is Payload provides any features like a CLI or hooks to do this?

  • discord user avatar
    zubricks
    Payload Team
    6 months ago

    Hey @gabrielsantos while we've built similar functionality in the past, we don't have anything off-the-shelf (yet) for Payload. It has been discussed here -

    https://github.com/payloadcms/payload/discussions/567

    and will likely make its way to our roadmap!

  • default discord avatar
    Jarrod
    6 months ago

    @gabrielsantos you could possibly get away with using a date field, and a beforeRead hook that checks the date on the publishAt date field, if less than now

    and

    not published, publish the doc - after the update return the updated doc in your hook. If the post is already published you could skip that step and return the doc arg given to you in the beforeRead hook.



    This might help get you to a working solution 👍

  • discord user avatar
    zubricks
    Payload Team
    6 months ago

    Good call Jarrod!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.