How to determine the changes to an object

0
Is it possible to determine the changes to an object in a microflow? Without retrieving the database object and comparing every attribute?
asked
2 answers
1

Hi Max,

I have done something similar to this.  See the microflow below:

In my case, I want to compare two separate instances of an object.  However, in the loop with that iterates over MxObjectMember, you could use Java action MemberHasChanged to see if a particular attribute or association has been changed.  I think this is what you want to do.

Hope that helps,

Mike

answered
1

Found the solution:

Create a JavaAction that receives a list of IMendixObjects and a reference object with same members.

Define

Fill it with this code:

public java.lang.Void executeAction() throws Exception
{
	// BEGIN USER CODE
	List<? extends IMendixObjectMember<?>> memberList = Reference.getChangedMembers(this.context());
	Iterator<? extends IMendixObjectMember<?>> memberIterator = memberList.iterator();
	Iterator<IMendixObject> objectIterator;
	while(memberIterator.hasNext()) {
		objectIterator = ObjectList.iterator();
		String memberName = memberIterator.next().getName();
		while(objectIterator.hasNext()) {
			objectIterator.next().setValue(this.context(), memberName , Reference.getValue(this.context(), memberName));
		}
	}
	return null;
	// END USER CODE
}

Create a workflow and call the java action with List and Reference:

 

answered