Association change registration via microflow

0
I would like to be able to react to a change in a parameter and perform a specific task as a result. I have two enitines, A and B. Between the two enitines there is a relation that allows to select a parameter from table B for entity A.  To explain: the user can select (from table B) one of the values for table A: X, Y or Z (these are user-set parameters, so I anticipate the question that this cannot be an enumeration). The user opens a pop-up where can change this value and then save the changes. To be clear, such enitity relations A has many more - there are entities C, D, .... and there are parameters in each of them. At the time of saving, a commit takes place (in the microflow). And I would like my microflow to be able to register that a change has occurred (and only when it has occurred - if the user hasn't changed the value then it shouldn't register any event). I've tried using memberHasChanged and getOriginalValueAsString from Community Commons but they don't work - memberHasChanged always returns "true" and getOriginalValueAsString returns the current value (this happens when I call this java action both before and after commit). Is the only option to first "retrive" all associations to another temporary entity and then compare each old one with the new one? Do you have any other idea how to register such an event most effectively?
asked
1 answers
1

In the microflow the input parameter is A.

The first action is a retrieve from database with the xpath [id = $entityA], name this entityA_db. This will hold the original value before the save by the user. Now you can compare the associations:

in a decision:

$entityA/A_B != $entityA_db/A_B

this is either true or false and based on the outcome you can handle the event that you want to create.

answered