Translate

Sunday, March 31, 2019

How to overide EDT relation lookup in AX 2012

Scenario: Customer need is to customise the lookup filter values of an ItemId EDT in the SysQueryForm

public void executeQuery()
{
    QueryBuildDataSource itemidBuildDataSource;
 
    itemidBuildDataSource = this.query().dataSourceTable(tableNum(InventTable));
 
    itemidBuildDataSource.addRange(fieldnum(InventTable,ItemType)).value(SysQuery::value(ItemType::Item));
 
    super();
}

Friday, March 1, 2019

Get contact person name and contact number of purchase order delivery address

In this blog, I will discuss how we can get the contact person name and contact number of the purchase order delivery address located in the line details tab of the PurchTable form.

Source Code:

    public static void main(Args _args)
    {
        LogisticsElectronicAddress  electronicAddress;
        PurchTable                  purchTable;
        LogisticsLocation           logisticsLocation, logisticsLocationParent;

        purchTable = PurchTable::find("PurchId");
        logisticsLocationParent = LogisticsLocation::find(purchTable.deliveryAddress().Location);

        select ParentLocation, RecId from logisticsLocation where
                logisticsLocation.ParentLocation == logisticsLocationParent.RecId;

        electronicAddress = LogisticsElectronicAddress::findByLocationAndType
                    (logisticsLocation.RecId, LogisticsElectronicAddressMethodType::Phone);

        info(strFmt("Contact number: %1", electronicAddress.Locator));
        info(strFmt("Contact Person : %1", electronicAddress.Description));
    }