Reset Input Field Data based on an enumeration

Hi.. I have a an input form that saves some data to an entity. It has a Radio button selection for an enumeration "Tool Expenses" and "Other Item Expenses". I have managed to set the visibility of the fields relevent to each type of Expenses according to the enumeration. If some one selected  "Tool Expenses" and add data to the relevent fields, and decided suddenly to change the expense type to "Other Item Expenses" The tool Expense fields will disappear and the Other Item Expense Fields show up. Thats good.  BUT, the problem is that even though we cant see the invisible fields, the data that has already been entred on those fields gets updated in the Entity.  Is there any possible way to avoid the data entred on the the invisible fields to get saved in the entity?? Or is there any way to Reset specific Input fields based upon an Enumeration Value? So that the fields that gets invisible will get reset and blanks as soon as the user selects the other enumeration?? Please help, I tried avery thing I know, but no use   Dilan
2 answers


Lets call your attributes toolExpense1, toolExpense2, otherExpense1, otherExpense2 and expenseType.  You can create a microflow that checks the value of expenseType and resets the expense attributes as appropriate.  So if the value of expenseType is Tool, you can set otherExpense1 and otherExpense2 attributes to empty, and if the value of expenseType is Other, you can set toolExpense1 and toolExpense2 to empty.  Once this microflow is created, go to your page and set this microflow as the OnChange microflow for the expenseType Radio button.  In this way, when expenseType changes, the hidden attributes will be set to empty.

Hope that helps,


P.S. some datatypes (date, integer, decimal, boolean, binary, etc.) can't be set to empty, so you'll need to set those to the default values or some other appropriate value



Yes the above mentioned method worked. But I made a mistake by setting "commit" to entity in the edit object activity. Be sure to not to set "commit"..