Forum Discussion

tenny's avatar
tenny
Ideator III
7 years ago

What's the event in relationship item type when we user save as function?

We  have an item type have one relationship item type, We want to modify the relationship item type's property value when user use the Save As function. 

We have tested that the event onbeforecopy only work in parent item type, doesn't work in relationship item type. Anyone could give me a hint about it?

4 Replies

  • Hi tenny,

    in which ItemType do you have definied the onBeforeCopy event? In the Parent ItemType or the ItemType of the Related Item? E.g. you want to react on chances in the Part BOM, use your event in the ItemType "Part_BOM" instead of "Part". 

    • tenny's avatar
      tenny
      Ideator III

      Hi Angelalp,

      I definied the onbeforecopy event in related item .For example, I have a item type A and have a relationship A_detail ,

      We want to do something in A_detail when user user Save as in Item typa A's main grid.

      Thanks.

  • Hi tenny,

    ah, my first advice wasn´t correct. onCopy events are just triggered on the items where you apply the “Save As”. Additional onCopy events in the relationships will not be considered. You need a different approach to solve this one:

    Example: I use an onAfterCopy Event for solving the following use case: If a Part is copied, some Part properties and the Part Goal relationships shall be reset to zero. For solving this purpose, I added an onAfterCopy server event in Part, that also covers the relationships:

    https://gist.github.com/AngelaIp/eadc237ae3369fc90f7002f439c39735

    Ciao

    Angela

    • tenny's avatar
      tenny
      Ideator III

      Hi Angela,

      Thanks a lot.