Hi all, I have an automation that at certain conditions performs operations on some orders. Let me give an example.
I have Orders database that has a one-to-many relation with Items.
I have an Orders entity, say Order1, that is related to two items entyties, Item1 and Item2.
When the field Status of Order1 entity changes to “Renegotiated” I want do the following:
Entity Order1 be copied to Order2
Entities Item1 and Item2 be copied to Item3 and Item4
Entity Order2 be related to Item3 and Item4
This is needed to let apply changes to Order2 items that do not reflect on Order1 items.
I’ve tried to assign Order1.Items to Order2.Items but this “detach” Item1 and Item2 from Order1 and “attach” them to Order2, leaving Order1 empty.
Many-to-many relation is not an option because of changes to Order2 items reflected to Order1 and viceversa.
(you should probably hide this field and it’s opposite on entity view)
Define an automation in the Order database to create a new Order AND to trigger the Duplicate automation for each Item, by linking this new Order to them:
If you don’t, then you will be able to see that the old and new entities are linked together, but you won’t be able to re-run the automation for any given Order/Item.
If it is possible that you need the duplication to happen more than once (i.e. if an Order will enter the Renegotiated state more than once) then you will need to clear the fields.