Community Commons clone and System attribute createdDate

1
If we use clone java action of community commons, it also copies createdDate of the object. Is there a way to set the system attribute "createdDate" manually or how can I restrict clone method not to copy this attribute? Thanks in advance
asked
1 answers
4

Use deepclone, it has a parameter 'membersToSkip', fill that with "createdDate". You have to excluded all entities to prevent the deepclone functionality, unless your object has no associations.

The other option is to tweak clone and add 'membersToSkip'. Beware updates from the appstore.

        public static Boolean cloneObject(IContext c, IMendixObject source,
            IMendixObject target, Boolean withAssociations, String membersToSkip)
    {
        Map<String, ? extends IMendixObjectMember<?>> members = source.getMembers(c);
        for(String key : members.keySet()) 
            if (!membersToSkip.contains(key) ){
            IMendixObjectMember<?> m = members.get(key);
            if (m.isVirtual())
                continue;
            if (m instanceof MendixAutoNumber)
                continue;
            if (withAssociations || ((!(m instanceof MendixObjectReference) && !(m instanceof MendixObjectReferenceSet))))
                target.setValue(c, key, m.getValue(c));
        }
}
        return true;
    }
answered