Also possible to use Schedule workflow and run it 24 times.
(You create a thing “Clone”: processed, requested. When user click clone, this set requested to 24 and processed to 0 and send to Schedule API Workflow. The API Workflow Clone the item, make a change to current “Clone” item: processed: this clone processed +1 and Schedule Api workflow only When processed < requested.
I´ve just remembered that it does not have to be always 24 times. I need to let the user to duplicate up to 24 times but it can be lower than 24. Will this work as well?
When a user creates for example the next 6 invoices, and then he modifies the second duplicate. We should ask if the modification only affects to the current invoice or to the another 4 one´s that comes from the first duplicated invoice. If he says to affect the next duplicated ones, we need to update them also.
So we can say something like: “Hey this invoice has 4 more that comes from duplicated one, do you want us to update those 4 or just this one?”
Maybe we should put in that clone thing the invoice (the one that has been duplicated) unique id?
So I´m figuring that we might need to track somehow that the duplicated ones comes from what invoice.
It’s more complicated. Will user always edit the master one?.. If yes, I suggest you to have a master invoice app and when user create clone, this create thing in a different app and all item will be linked to the master. Then you can update related clone if needed. This may be easier to find original one like this. You can also use a field and type to know which one is original or clone.
I´m thinking about maybe having the master invoice unique id saved in the duplicated ones so when the user tries to edit the duplicated ones, we do a search for to that unique id, and then we know that the newer invoices with the “duplicated invoice id” field can be updated with new values.
If the user asks to update the newer duplicated invoices, we will first delete the duplicated ones and then create a duplicate of the current one that we´re trying to modify.
For example: a user tries to edit the next invoice prior to the master one.
We ask the user when hitting the save button if he wants to update the newer ones because the current invoice comes from a duplicated one.
If he says yes, we can rest hehe.
If he says that he wants to updated the newer ones. We would delete all the duplicated ones first and then duplicate again but this time we´ll be duplicating the current invoice.