How to reset an unique item property FAST on item copy / Save As
Hi community,
I have a simple ItemType with an item property that links to a Part. The item property is "unique" AND "required". User shall be able to copy the item via Save As.
When using Save-As to copy the item, I get the expected error:
Violation of UNIQUE KEY constraint "UN7732". A duplicate key cannot be inserted into the innovator.ITsNotAI object. The duplicate key value is (123456....).
Something like this is an onBeforeCopy event unfortunately doesn´t work:
this.setProperty("my_item_property", "");I know tons of complex over-engineered solutions to address the problem. E.g. don´t use the unique attribute and use a Method for uniqueness check and "onAfterCopy" for item edit. Or use a custom CUI copy button....
But somehow all these idea mean more Methods for a trivial problem.
Isn´t there a way to address this task with ONE simple unique "onBeforeCopy" Method?
From my POV the main obstacle is that Innovator automatically saves the item after copy. But I don´t need the copied item to be saved instantly. Why not just display it as new temporary new item to the user?
I did some attempts to overwrite the default onBeforeCopy logic to simulate a temporary Part. But Innovator doesn´t honor my current ideas yet. :)
Does anyone has an idea to address this task in a very simple way?
Is it possible to prevent that Aras automatically saves the item after copy?
Thanks!
Angela