Empty all the attributes of an object in a microflow

0
Hi everyone,  I am developping a button that should empty all the fields of several objects linked. What I thought first was to delete and recreate the objects. The problem is that it doesn’t refresh in the screen, I am forced to recall the page after creating the new objects. Is there a way to just say in a microflow: “Empty all the fields of this object” ?  And if not, is there a way to make my first try refresh instantly ?  Thanks for the help, Dan
asked
4 answers
2

Dan,

In your microflow, you could:

  • create a new (empty) object of the same type as the one you have in the page
  • use the Clone java action from Community Commons and clone the empty object your created into the object on the page
  • commit the existing object (to refresh in page)
  • delete the empty object as you have no use for it anymore.

Hope that helps,

Mike

answered
1

You can just write some Java for that, iterate over the imendixobject’s attributes and set to null, then you dont have to fiddle with the microflow when adjusting your attributes.

 

// BEGIN USER CODE
for(java.lang.String k:obj.getMembers(this.getContext()).keySet()){
    try{obj.setValue(this.getContext(),k,null);}catch(Exception e){}
}
return true;
// END USER CODE

 

@Mendix: Fix your code editor

answered
0

The easiest way is to just change the object in a microflow and empty all the attributes and refresh the page checked in the Change activity. 

Empty all attributes is not an existing feature.

answered
0

Thanks all for the answers

answered