I am trying to set doneDate currentDate onChange done field.

default discord avatar
anisulislampranto
2 months ago
3

getting this error



  • discord user avatar
    alessiogr
    Payload Team
    2 months ago

    admin > date doesn't have a "condition" property. Conditions are used to conditionally show or hide fields depending on... some condition. You can't use them to set a field's value.



    It sounds like what you want would be a beforeChange hook (relevant docs page:

    https://payloadcms.com/docs/hooks/collections

    ).



    When the done field is modified, you can return a new value for the doneDate field inside the beforeChange hook

  • default discord avatar
    anisulislampranto
    2 months ago

    Worked. Thanks

  • default discord avatar
    etmartinkazoo
    3 weeks ago

    Hi @anisulislampranto - Would you have an example of your updated code using the beforeChange hook? I am looking to do something similar.

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.