I’m currently trying to duplicate a group with 34 items through the graphQL API. So far so good, the API is easy to use & the request schema helps a lot.
I encounter the following problem:
I successfully duplicate a group with the following mutation query:
mutation {
duplicate_group (board_id: ${boardId}, group_id: ${groupId}, add_to_top: true) {
id
}
}
The group is duplicated in monday & visible. However, not all items of the group are present in the duplicated group. The number varies. Sometimes I get 15/34, other times I get 18/34…
I suspect this might be because my whole custom action exceeds the query complexity limit (it performs more than 1 query). But, I would expect in this case that monday returns a status code 429, this is not the case.
The size of the group does not change the duplication cost – so you don’t have to worry about that. As long as you’re under your complexity budget and not making more than 40 calls a minute, you’re fine.
This might be either a temporary problem or a board-level issue. Try the following steps and let us know what you find:
Do the items appear eventually? Sometimes when you duplicate a board or group it can take a few minutes for the operation to finish. Shouldn’t take too long though (if you’re waiting 10 mins or more, something’s wrong).
Have you been able to duplicate this group before?
Can you duplicate other groups successfully? Try to duplicate groups on other boards and see if they suffer the same problem. If they don’t, then the problem is scoped to that one group or board.
Can you successfully duplicate the group via the web platform? If the issue is reproducible in the web, then it’s an issue with that group.
Send us the results of this investigation and we’ll take it from there!
Thanks for the quick answer. I followed your diagnostic steps, and here are the results:
No the item do not appear eventually, I waited over night, without success.
Yes I’ve duplicated this group before, but through the web interface.
Seems like duplicating other group for my specific use case causes the same problem…
Through the web interface, the duplicate group action works flawlessly.
I investigated some more and I have another hypothesis on what is happening, but first let me provide some context on my use case. My custom action does the following:
When triggered, it creates a board from a template
Then it gets the number value of a number column of the trigger item
Then it gets all group in freshly created board and filter for the group with provided ‘name’ in receipe
Then it duplicates this group N times, where N is the number value of the trigger item.
Since the duplicated group is from a board that is created ms before, could it be that the create board operation has not completed yet ? or maybe the create board operation has not finished creating all items ?
Thank you for that explanation. I think your hypothesis might be correct.
Can you test if it is? You can do so by adding some timeouts here and there to give monday some time to create the groups completely before you try to duplicate them. I would try (for testing purposes) adding 90 seconds between steps, to see what happens. You can then play with that number as needed.
Yes this was the problem! Although it works for debugging, the final solution is not to add waits between steps.
I think I will query the API every X period of time (with maybe a backoff strategy) (ex: 10, 30, 60 sec) until all items are created, then I will trigger my duplicate group.