As I’ve progressed as an AX developer, I’ve had to lean on many of the skills that I had from a former job as a C# developer where I used a lot of SQL queries. Working with data in X++ is similar until you try to write it like it would be written in SQL.…
One of least understood but most powerful Axapta features is the so-called Expressions in query ranges syntax. This is not the same as simply using a QueryBuildRange object in a query and specifying a criteria for a single field. Contents [hide] 1 Introduction 2 Syntax 3 Examples 3.1 Simple criteria 3.2 Complex criteria with combined AND and OR clauses 3.3 WHERE clauses referencing fields from…
Find below job to create and post purchase order in Dynamics AX 2012 Note: Referring contoso demo data, ‘CEU’ company static void CreatePOAndInvoice(Args _args) { PurchTable purchTable;PurchLine purchLine;VendTable vendTable = VendTable::find(“3008”);AxPurchTable axPurchTable;AxPurchLine axPurchLine;PurchFormLetter purchFormLetter; //Create Purchase orderpurchTable.initFromVendTable(vendTable); axPurchTable = axPurchTable::newPurchTable(purchTable);axPurchTable.parmPurchaseType(PurchaseType::Purch);axPurchTable.parmDocumentStatus(DocumentStatus::PurchaseOrder);axPurchTable.parmAccountingDate(systemDateGet());axPurchTable.parmDeliveryDate(016\2012);axPurchTable.parmPurchStatus(PurchStatus::Backorder);axPurchTable.doSave(); //Create PurchLine for item 1000purchLine.initFromPurchTable(purchTable); axPurchLine = AxPurchLine::newPurchLine(purchLine);axpurchLine.parmItemId(“1000”);axPurchLine.parmPurchQty(10);axPurchLine.parmPurchPrice(100);axPurchLine.doSave(); //Posting PO Confirmation,I guess its mandatory//You cannot…
Source Event Parm Example Class Pre/Post event XppPrePostArgs Get args and parmameter values from a method that is being extended. Parm 1 = Object Parm 2 = CommonPurchCreateFromSalesOrder callingClass = args.getThis() as PurchCreateFromSalesOrder; Object callerObject = args.getArgNum(1) as Object;Common callerRecord = args.getArgNum(2) as Common; Class Pre/Post event XppPrePostArgs Class example: SalesLineType salesLineType = args.getThis() as SalesLineType; …
Good day everyone, Today I will continue talking about how to pass multiple records to class, this time I will do it using the helper class MultiSelectionHelper. The MultiSelectionHelper class provides an interface to work with multiple selected records on a form data source and which can be cached, if called on server it will…
Purpose:The purpose of this document is to show how to get multiple selected records in form control event handlers. Development:First of all create new event handler class HRPayrollPayStatementEventHandler and subscribe to form button OnClicked event handler. /// /// The HRPayrollPayStatementEventHandler class is the event handler class for managing PayrollPayStatement form events ///class HRPayrollPayStatementEventHandler{ }
Simple dialog with field validation and control override method: class VKSalesOrderCloseDialog extends RunBase{DialogField dlgHoldCode,dlgReasonCode,dlgNotes;MCRHoldCode holdCode;RetailInformationSubcodeId reasonCode;Notes notes; }Object dialog(){Dialog dialog = super(); }boolean getFromDialog(){holdCode = dlgHoldCode.value();reasonCode = dlgReasonCode.value();notes = dlgNotes.value(); }public container pack(){//return [#CurrentVersion,#CurrentList];return [#CurrentVersion];}public MCRHoldCode parmHoldCode(MCRHoldCode _holdCode = holdCode){holdCode = _holdCode; }public Notes parmNotes(Notes _notes = notes){notes = _notes; }public RetailInformationSubcodeId parmReasonCode(RetailInformationSubcodeId _reasonCode =…
Add a new Runnable class and rename it CustTableDlg: Create a dialog method to capture runtime user inputs for customer details: Override the method getFromDialog, the code below will be used to retrieve the Dialog field values: Override the method run, use it to process whatever you want to. On my example I will use…
This article shows how to create and use a RunBaseBatch class : http://www.axaptapedia.com/RunBaseBatch
Hi, Vendor address state value can be retrieved from tables VendTable, DirPartyTable, DirPartyLocation, LogisticsLocation and LogisticsPostalAddress (or) through the view DirPartyPostalAddressView(mentioned in the blogs suggested by Vilmos) You can use the following job(query) to get the data and to update the state:static void VendorState(Args _args){VendTable vendTable;DirPartyTable dirPartyTable;DirPartyLocation dirPartyLocation;LogisticsLocation logisticsLocation;LogisticsPostalAddress logisticsPostalAddress;LogisticsAddressState LogisticsAddressState; while select vendTablewhere vendTable.AccountNum…
[ExtensionOf(formdatasourcestr(HcmWorker, HcmWorker))]
It is not always obvious what request is actually executed on SQL Server. The most confusing is probably exists join in X++. Let’s analyze how joins in select statement in X++ are translated into T-SQL statement sent to SQL Server. 1. join in X++: select AccountNum from custTablejoin TaxGroupId from custGroupwhere custGroup.CustGroup == custTable.CustGroup; CROSS JOIN in T-SQL: SELECT T1.ACCOUNTNUM,…
With the following code we can able to import the project budget and revising too
[ExtensionOf(formStr(ProjStatistic))].
There are “only” 5 ways to close a form:1. Close – close the form2. CloseOK – close the form, and set the OK flag – called by the commandbutton: Ok3. CloseCancel – close the form, and set the Cancel flag – called by the commandbutton: Cancel4. CloseSelectRecord – close the lookup form, and set return record5. CloseSelect – close the lookup form, and set return…
Wait for a while for the second line to appears Press “Pofile runs”
One of least understood but most powerful Axapta features is the so-called Expressions in query ranges syntax. This is not the same as simply using a QueryBuildRange object in a query and specifying a criteria for a single field. Contents [hide] 1 Introduction 2 Syntax 3 Examples 3.1 Simple criteria 3.2 Complex criteria with combined AND and OR clauses 3.3 WHERE clauses referencing fields from…
This post discusses about creating a custom lookup field on a dialog.Following are the methods and code required to achieve the purpose.(Assuming the class is extending the RunbaseBatch) –> A lookup method is required in the first place. Below is the sample code to lookup the exchange rates.private void exchRate_Lookup(FormStringControl _control){SysTableLookup sysTableLookUp;QueryBuildDataSource qbds;Query query =…
For displaying all/specific AOT objects like tables in the lookup control, we need to iterate the UtilidElements table with our desired criteria. static void lookupAOTTables(FormStringControl _ctrl){ SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(UtilidElements), _ctrl); Query query = new Query(); QueryBuildDataSource …
Hi Friends,In this post I would like to share a small piece of code using which we can get oh hand values for an item. Before jumping to it I would first like to share some basic information related to on hand information.What do we need to know when we have to calculate on hand…
Using the class InventDimOnhand, you can determine the on-hand inventory of articles and/or specific inventory-dimensions. The following job determines the inventory for a specific item and a specific inventlocation. This is grouped per color. static void getInventOnhandExample(Args _args) { ItemId itemId; InventDimOnHand inventDimOnHand; InventDimParm inventDimParmOnHandLevel; InventDimOnHandIterator inventDimOnHandIterator; InventDimOnHandMember inventDimOnHandMember; InventDim inventDim; InventDim inventDimCriteria; InventDimParm inventDimParmCriteria; //…
In previous versions of AX you had a table browser in the AOT which allowed you to view the data, modify or delete it while executing any table methods that may have been associated with it. In D365 you can no longer access the table browser the same way as you not longer have access…
Purpose: The purpose of this document is to illustrate how we can confirm purchase orders in X++ using PurchParmTable table and PurchFormLetter class. Business requirement: Ability to confirm purchase order automatically. As of now Standard AX offers manual purchase order confirmation by clicking Procurement and sourcing > Common > Purchase orders > All purchase orders > Purchase > Generate > Confirm. Assumptions: The purchase order…
Why Containers? In X++ (Object oriented programming language) the data or values stored in a Variable are of below types: Primitive dataTypes – int, str, real …. etc. Composite dataTypes – Arrays, Containers, Collection Classes Temporary Tables For instance, Primitive dataType variable can hold only 1 value and that too of same dataType, if you want to…
What the difference between InventOnHand and InventDimOnHand classes and in what cases they must be used? Axapta InventOnHand class is wrapper for InventSum table. Unique index for InventSum table is ItemId + InventDimId. In other word, this class is used to get on hand for item with specific dimension. For example, if you require getting on-hand qty…
To enable “Records to include” filter in a RunBaseBatch class just set these two methods like shown below public QueryRun queryRun() { next queryRun(); return queryRun; } public boolean showQueryValues() { next showQueryValues(); return true; }
This function will return the name associated with the current user. If you just want the current user ID, use curUserId() XUserInfo::find(false, curUserId()).name;
If you are inside a class and want to call an instance method that belong to the same class you can call it by using this.{method_name}. Example :
If you want to check if a string field has a non-empty value you can use sysquery::valueNotEmptyString() method Some examples: //Make a query that extract all PurchLine rows with PurchId with a non-empty value : this.query().dataSourceTable(tableNum(PurchLine)).addRange(fieldNum(PurchLine,PurchId)).value(sysquery::valueNotEmptyString());