Question about GetChangedMembers (Tough question answer if you dare)

0
Hi everyone,   I’ve created a Java action that uses the GetChangedMembers function to return a JSON object containing all changes made to an entity — including both the original and new values. Initially, this seemed to work well. However, I’ve encountered some unexpected behavior while testing it with an entity called Report, which has a one-to-many association with Stakeholder. In this relationship, Stakeholder is the owner.   The issue is that when I add or remove Stakeholder objects from a Report, GetChangedMembers doesn’t detect any changes. I had assumed that modifying the associated objects would be picked up, but that doesn’t seem to be the case. Does anyone know how GetChangedMembers handles associations, especially when the current entity is not the owner of the relationship? Is there a recommended way to detect changes in associated objects like this?   I’m considering changing the ownership of the association to see if that affects the behavior. I’ve noticed that changes are correctly detected when the current entity is the owner of the association. Are there any guidelines or best practices for deciding which entity should own an association? Thanks in advance for your insights!
asked
1 answers
2

If the entity is not the owner of the association  the association is not percieved as being a member of the entity and therefore the GetChangedMembers will not detect the change as this looks at the members of the entity.

Removing the stakeholder from the report is therefore a change of the member of the stakeholder and will be shown with the GetCHangedMembers perfromed on the stakeholder entity.

So to get your complete information you will need to combine the values for the changes on both the report and the stakeholder entities, or store the deleted stakeholders temporarily in an association opwned by the report entity.

answered