Duplicating a collection item

default discord avatar
last month

i am using beforeValidate to create a unique slug when a new post is created. it works just fine as it is now

The problem i find is that if i try to duplicate the field in the adminUI it wont work anymore.

I am wondering how i can get in between what ever the duplicate button does?

hooks: {

beforeValidate: [

async ({ data, value }) => {

return await creatuSlug(









The beforeDuplicate hook is an async function that accepts an object containing the data to duplicate, as well as the locale of the doc to duplicate. Within this hook, you can modify the data to be duplicated, which is useful in cases where you have unique fields that need to be incremented or similar, as well as if you want to automatically modify a document's title.

  • discord user avatar
    Payload Team
    last month

    @Raoul sounds like you are all set, right?

  • default discord avatar
    last month

    i think i am 🙂

    @jarrod_not_jared I got back to this now, seems that i am stuck after all, can't seem to get in between the duplication process.

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


Connect with the Payload Community on Discord



Can't find what you're looking for?

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