Ax 2012

Change amount of visible elements on the form depending on selected record.

I was creating form and regarding on the value of the record, I had to add or remove specific form elements ( fields and etc. )

The most convenient place to do that is on a data source, in method Active. It is possible that you have to try few data sources and decide which one suits you more.

Although this doesn’t work during initialization of the form. When you open the form it gathers 0 instead of actual record value.