Clone and Deepclone can be found in the community commons module from the appstore. But you should be carefull with them, because they can also take care of associations and that can lead to unexpected behavior.
If you only want to copy attributes, you can also find a java action called copyAttributes. It is doing what you need. It copies attributes with the same name from one object to another. It does not need to be the same entity.
Thank you for your advice to be careful about Clone and Deepclone.
I have tried to work it out with copyAttribute, but I just can't get it to work and I'm not sure how to solve this.
I have created the Microflow ‘PrequalifyTender’ which gets activated when pressed on a button called ‘Kwalificatie’.
I have created 3 activities in the Microflow: the first one is to change the Attribute ‘Kwalificatie’ of type boolean in entity Tenders to true and this doesn't give an error. The third and final activity is a commit and this doesn't give me an error right now.
The second activity however is the activity copyAttributes and this gives an errorcode CE0126 with the message ‘missing value’ and Mendix doesn't proceed because of the error:
Parameter ‘Parameter’ of action activities ‘Copy object attribute contents’.
I will attach a screenshot of the Microflow below.
I have searched on the Net, but I can't find a solution; can you help me out?
I have removed copyAttributes and now my project is producing errors and won't compile.
The errors that I receive is this:
[javac] C:\Users\xxxx.xxxx\Documents\Mendix\Bidkwalificatie-EXPERIMENTAL-v2\javasource\objecthandling\actions\copyAttributes.java:42: error: cannot find symbol
[javac] ORM.copyAttributes(getContext(), source, target);
[javac] ^
[javac] symbol: variable source
[javac] location: class copyAttributes
[javac] C:\Users\xxxx.xxxx\Documents\Mendix\Bidkwalificatie-EXPERIMENTAL-v2\javasource\objecthandling\actions\copyAttributes.java:42: error: cannot find symbol
[javac] ORM.copyAttributes(getContext(), source, target);
[javac] ^
[javac] symbol: variable target
[javac] location: class copyAttributes
[javac] C:\Users\xxxx.xxxx\Documents\Mendix\Bidkwalificatie-EXPERIMENTAL-v2\javasource\objecthandling\actions\copyAttributes.java:43: error: incompatible types: boolean cannot be converted to IMendixObject
[javac] return true;
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 3 errors
I have removed the App Store module copyAttributes and I have redownloaded the module Community Commons Function Library and I have chosen to replace the existing module, but it didn't help.
Can you please help me out to fix this?
I have removed the module copyAttributes. I have reinstalled the Commons Commons App, but it doesn't restore the copyAttributes module since I can't select it in an activity. I have also tried to restart Mendix Studio Pro, but that doesn't help. The three questions I have are : 1) What can I do to get copyAttributes back? 2) Can somebody please give me some (detailed) help how to use the copyAttributes module in order for me to copy attributes? 3)Is there perhaps an alternative way to copy attributes from one entity to another entity in Mendix 8.8.2?
Thank you for helping me out!