Empty all the attributes of an object in a microflow
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
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
// END USER CODE
@Mendix: Fix your code editor
𝕺𝖈𝖐𝖊𝖗𝖙 𝖛𝖆𝖓 𝕾𝖈𝖍𝖆𝖑𝖐𝖜𝖞𝖐
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,
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.