AX / D365FO – How to Call table Display method in Custom lookup – X++

In this simple example I'll show how add a Table display method as a field of a custom lookup field public void dialogCustVendRel_lookup(FormStringControl _control) { Query query = new Query(); QueryBuildDataSource queryBuildDataSource; SysTableLookup sysTableLookup; sysTableLookup = SysTableLookup::newParameters(tableNum(VendTable), _control); sysTableLookup.addLookupField(fieldNum(VendTable, AccountNum)); sysTableLookup.addLookupMethod(tableMethodStr(VendTable, name)); // Setup query queryBuildDataSource = query.addDataSource(tableNum(VendTable)); sysTableLookup.parmQuery(query); // Perform lookup sysTableLookup.performFormLookup(); } }

AX / D365FO – Add a custom report design under Print management in AX 2012

Below are the steps to be followed : Create new Design for Report under visual studio Add code to method:\Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populateAdd code before TTSCOMMIT:addOther(PrintMgmtDocumentType::PurchaseOrderInvoice, ssrsReportStr(VendInvoiceDocument, MyReport), ssrsReportStr(VendInvoiceDocument, MyReport), #NoCountryRegionId);Choose you new format under:AP -> setup -> form setup -> Print management -> Vendor invoice -> report format to VendInvoiceDocument.MyReportNew Report design can be executed from … Continue reading AX / D365FO – Add a custom report design under Print management in AX 2012

AX / D365FO – Form Field allow edit based on conditon

If you want to allow edit only some fields on the form grid control this is an example that shows hot to reach this goal. 1. Create a Form method as below public void setFieldAccess() { if(XXXX == YYY) { FrmDataSource_ds.object(fieldNum(FrmDataSource,LineNum)).allowEdit(false); FrmDataSource_ds.object(fieldNum(FrmDataSource,Field2)).allowEdit(false); } } 2. Call the above method from the form Data source Active … Continue reading AX / D365FO – Form Field allow edit based on conditon

AX / D365FO – How to call an Action Menu Item in a Form event handler

In this example I want to call a menu item every time a Data source record is deleted [FormDataSourceEventHandler(formDataSourceStr(ProjSalesItemReq, SalesLine), FormDataSourceEventType::Deleted)] public static void SalesLine_OnDeleted(FormDataSource sender, FormDataSourceEventArgs e) { Args args = new Args(); FormRun formRun = sender.formRun(); //Get FormRun FormDataSource salesLine_ds = formRun.dataSource(formDataSourceStr(SalesLine, SalesLine)) as FormDataSource; //Get DataSource SalesLine salesLine = salesLine_ds.cursor(); //Get DataSource … Continue reading AX / D365FO – How to call an Action Menu Item in a Form event handler

AX / D365FO – Export Data Entity Enum fields labels in BYOD using Computed columns or Virtual fields

When you export a Data Entity in BYOD the base enums fields values are shown as integer values. This is a big problem because it's very difficult to understrand the real value of the field. To solve this issue you can extend the standard data entity or modify a custom one using a virtual field … Continue reading AX / D365FO – Export Data Entity Enum fields labels in BYOD using Computed columns or Virtual fields

AX / D365FO – Data Entity to extract Invoices and related Payment vouchers

If you need to extract invoices and related payment voucher numbers you can use 2 Data entities : "Customer payment journal line" or alternatively use "Customer payment journal line settled invoice" Access Data management > Export "Customer payment journal line" Data Entity Select "Customer payment journal line" Click "Export now" When completed click on "Download … Continue reading AX / D365FO – Data Entity to extract Invoices and related Payment vouchers

AX / D365FO – Update a Form Datasource control field in an Eventhandler

Below code shows how to get buffer from form data source field event handler(modified field) and update values as per the requirement [FormDataFieldEventHandler(formDataFieldStr(BankStatementTable, BankStmtISOAccountStatement, ToDateTime), FormDataFieldEventType::Modified)] public static void ToDateTime_OnModified(FormDataObject sender, FormDataFieldEventArgs e) { FormDataSource BankStmtISOAccountStatement_ds = sender.datasource(); BankStmtISOAccountStatement bankStmtISOAccountStatement = BankStmtISOAccountStatement_ds.cursor(); //Get Datasource record TimeOfDay secondsElapsed; secondsElapsed = 86399; if(!bankStmtISOAccountStatement.ToDateTime) { bankStmtISOAccountStatement.ToDateTime = DateTimeUtil::newDateTime(DateTimeUtil::getSystemDate(DateTimeUtil:: … Continue reading AX / D365FO – Update a Form Datasource control field in an Eventhandler