How can we validate our Customised/Standard( not in existing validation) field during Journal(Count & PL) validation and posting in Ax

Requirement:

When the journal is validated or posted from the post button on inventory journal or lines button on journal lines, inventory form, ensure that all the lines have adjustment code filled-in. if not, don’t post the journal and inform the user

Solution: apply the business logic in these class methods

## For Counting journal:

\Classes\InventMov_Jour_Loss_SumUp\journalCheckTrans()

## For Profit Loss journal:

*First override the method — journalCheckTrans

\Classes\InventMov_Jour_LossProfit\journalCheckTrans()

## In General

\Classes\JournalCheckPost\checkJournal()

 

How to achieve Multiselect Lookup in Ax 2009

* First set the ReplaceOnLookup property of the control to “NO

* Second set the control Autodeclartion property to “Yes

public void lookup()
{

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable), this);
Query query = new Query();
QueryBuildDataSource qbds;
;

sysTableLookup.addLookupField(fieldnum(CustTable, AccountNum), true);
qbds = query.addDataSource(tablenum(CustTable));

this.setSelection(strlen(this.text()),strlen(this.text()));
StringEdit.text(StringEdit.valueStr() + ‘,’);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();
}