InitValue Method


I’m having trouble leaving a field with flag cleared to open a form.
I created the method below, but it still fails.
Can anyone help me?


public void initValue()


CustBankFolderPlanning.Disable = NoYes::No;



InitValue() is called when a new record is being created, not when a form is opened (unless it automatically creates a record).

You also need to think about what you want to achieve. If you merely change the value of the current buffer, refreshing the record will throw your value away, while leaving the record will save it to database. Is it what you want?


Really, you’re right.
Are you talking like that, it seems pretty easy.
What I want is to let the filter defaults to “On” value to open the form, only to display these values​​.
If user wants all values​​, it can change this option in the filter.


You opened my eyes …
So I put in the init method:

CustBankFolderPlanning_ds.query().dataSourceTable(tablenum(CustBankFolderPlanning)).addRange(fieldnum(CustBankFolderPlanning, Disable)).value(“Não”);

Thank you very much !

Very good. :slight_smile:

Just use value(queryValue(NoYes::No)) instead of the hard-coded, language-specific text.

And if you’re in AX 2012, you can simplify your code with FormDataSource.queryBuildDataSource().