How to trigger relationship server event when parent item is copied?

Hi community,

maybe somebody know a solution for this use case. 

I use a Method in the ItemType 'Part BOM' that is triggered by an onAfterAdd and onAfterDelete event. The Method updates an integer property that indicates how often the corresponding child part is used at all. This one is helpful to highlight 'preferred' Parts that are more often used than others.

So each time when an user adds or deletes an Item in a BOM, the counter recalculates how often the child part is used by counting the number of related source parts. 

So far everything works perfect! There is only one usecase that crashes everything. When users copy the parent part (the most used way to add new items...), my calculation Methods in ItemType 'Part BOM' aren´t triggered! The onAfterAdd and onAfterDelete Methods are not called and so my counter property will not be updated. 

I tried all kind of server events available in my child relationship ItemType, but none reacts when copying the parent. 

What options do I have? It might be possible to use an onAfterCopy Method in the Parent ItemType that updates all child parts, but that´s much code for a small requirement. I wonder why my onAfterAdd child event is not triggered, because when I copy something, the child item has to be added.

Or is there some way to explicit trigger the child events with the onAfterCopy parent event?

Any help appriciated!

Thanks!

Angela

Parents
  • Hi Angela,

    I can reproduce this error on my local instance of 11.0 SP15. Looking through our internal list of issues, it seems that this is behavior that is seen before and is still being scheduled to be fixed. 

    In the meantime, I think your suggestion of adding an onAfterCopy method to the parent ItemType is the best workaround for now.

    There are a few other alternatives such as making this counter property a federated property and calculating it each time a Part BOM is retrieved from the database. While this would resolve the issue you're seeing, it would also slow down the process of opening and editing parts to the extra time needed for that calculation.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Reply
  • Hi Angela,

    I can reproduce this error on my local instance of 11.0 SP15. Looking through our internal list of issues, it seems that this is behavior that is seen before and is still being scheduled to be fixed. 

    In the meantime, I think your suggestion of adding an onAfterCopy method to the parent ItemType is the best workaround for now.

    There are a few other alternatives such as making this counter property a federated property and calculating it each time a Part BOM is retrieved from the database. While this would resolve the issue you're seeing, it would also slow down the process of opening and editing parts to the extra time needed for that calculation.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Children
No Data