24 July 2019

How to populate form data source with temp table. D365 FO and AX7

Create new form, add temptable as DataSource.

DS-> Init()

public void init() // init method of form data source. 
{
   CustGroupTmp tmpTable; 
   super();
   tmpTable.CustGroupId= "Test1";
   tmpTable.insert();
   tmpTable.CustGroupId= "Test2";
   tmpTable.insert(); 
   CustGroupTmp.linkPhysicalTableInstance(tmpTable); // CustGroupTmp is the form datasource name this cursor

//or 
CustGroupTmp.setTmpData(tmpTable);
TableType should be: InMemory
}

work in class inserting temptable records.

// to use the same logic in the class, pass the formDatasource-CustGroupTmp to class
if (_args.record().TableId == tableNum(CustGroupTmp))
{
 FormDataSource formDS = _args.caller().datasource(formDataSourceStr(CustGroupTmpForm, CustGroupTmp)) as FormDataSource;
 CustGroupTmp = formDS.cursor();
 formDS.executeQuery();
}

// FormDataSource fds
// CustGroupTmp custGroupTempBuffer = fds.cursor()
// custGroupTempBuffer.linkPhysicalTableInstance(tmpTable);

No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...