get ElectronicAddress(LogisticsElectronicAddress) By Location D365 FnO #AX2012 #D365FNO

static void getElectronicAddressByLocation(InventLocationID _inventLocationId){InventLocation inventLocation;LogisticsEntityPostalAddressView postalAddressView;LogisticsElectronicAddress electronicAddress;LogisticsLocation contactLocation; inventLocation = inventLocation::find(_inventLocationId));if (inventLocation){select firstonly postalAddressViewwhere postalAddressView.Entity == inventLocation.RecId&& postalAddressView.EntityType == LogisticsLocationEntityType::Warehouse&& postalAddressView.isPrimary == NoYes::Yes; if (postalAddressView){select firstOnly electronicAddress where electronicAddress.Type == LogisticsElectronicAddressMethodType::Phonejoin contactLocation where contactLocation.ParentLocation == postalAddressView.Location&& contactLocation.RecId == electronicAddress.Location; info(strFmt("Primary contact name: %1 Primary contact phone: %2",electronicAddress.Description, electronicAddress.Locator)); } } }

Get GST at Purch order Confirmation (PO Confirmation )

class GETPOConfirmtionGST{ /// <summary> /// Runs the class with the specified arguments. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { vendPurchOrderJour vendPurchOrderJour; PurchLineAllVersions ObjPurchLineAllVersions; ITaxDocument taxDocument; ITaxDocumentComponentLineEnumerator componentLineEnumerator; ITaxDocumentComponentLine componentLineObject; ITaxDocumentMeasureEnumerator measureEnumerator; ITaxDocumentLine line; ITaxDocumentLineEnumerator lineEnumerator; TaxAmount taxAmount,taxValue; TaxComponent_IN taxComponent; ; vendPurchOrderJour = vendPurchOrderJour::findRecId(VendPurchOrderJour::findByPurchId("PurchId").RecId); taxDocument = TaxBusinessService::getTaxDocumentBySource(vendPurchOrderJour.TableId, vendPurchOrderJour.RecId); … Continue reading Get GST at Purch order Confirmation (PO Confirmation )

Electronic Address from InventLocation (warehouse)

public LogisticsElectronicAddress getElectronicAddressByPostalAddress(InventLocation _inventLocation, LogisticsElectronicAddressMethodType _type){LogisticsLocation logisticsLocation;InventLocationLogisticsLocation inventLocationLogisticsLocation;LogisticsElectronicAddress electronicAddress; select firstOnly RecId from inventLocationLogisticsLocation where inventLocationLogisticsLocation.InventLocation == _inventLocation.RecId join RecId from logisticsLocation where logisticsLocation.ParentLocation == inventLocationLogisticsLocation.Location; electronicAddress = LogisticsElectronicAddress::findByLocationAndType(logisticsLocation.RecId, _type); return electronicAddress; }

SET Based Entity (Microsoft Dynamics 365 for Operations)

SET Based Entity (Microsoft Dynamics 365 for Operations) The AX application layer is responsible for processing data that moves in or out of the AX database.  When data is inserted or updated in a table, the application layer runs any business logic that is needed to validate the data or post processing business logic such … Continue reading SET Based Entity (Microsoft Dynamics 365 for Operations)

Display methods in Form unbound control for Microsoft Dynamics 365 for Operation(D365 or O365)

A Display method is used to display a calculation or data from another table.  The method modifier display is added to the beginning of the method definition line to allow the return value to be displayed on a form. Display methods can be created either on a table or on a form DataSource.  If it … Continue reading Display methods in Form unbound control for Microsoft Dynamics 365 for Operation(D365 or O365)

Parallel workflow with example(Part -2) AX 2012

Parallel workflow:A parallel activity is a workflow element that includes two or more workflow branches that run at the same time. Note :Workflow will not be completed until parallel branches are completed. Example: User will create a Free text invoice with associated with asset number, So check Asset is available or not , if asset number … Continue reading Parallel workflow with example(Part -2) AX 2012

Workflow with Example (PART-1) AX 2012

Workflow: Workflow is defined as the movement of documents or tasks through a work process and provide the transparency. workflow life cycle is DESIGN -> CONFIGURATION -> RUN Developer design the workflow based on customer requirements. The company administrator configures the workflow. Users run the workflow. Configure/Create workflow: Create a workflow configure the properties specify … Continue reading Workflow with Example (PART-1) AX 2012

Difference between table method and table events in Ax 7

​Small concept of event and table method: difference betweenonUpdated() and the post-event to the update() method. Let me explain it with a little example. Having an update() method like this public void update()  {  method1();  super();  method2();  } that has a pre-event as well as a post-event has the following execution order: 1.Pre-event subscriptions 2.method1(); … Continue reading Difference between table method and table events in Ax 7

Convert CSV to EXCEL file in AX 2012

  static void ConvertCSVtoEXCEL(Args _args) { #Excel SysExcelApplication excel; SysExcelWorkBooks books; Filename excelFileName; Filename csvFileName; ; csvFileName = 'C:\\<.....>\\TEST17.csv'; excelFileName = 'C:\\<.....>\\2.xlsx'; excel = SysExcelApplication::construct( ); excel.displayAlerts (false); books = excel.workbooks( ); books.open(csvFileName,0,false,2,"","",false,#xlWindows,",",false,false,1,false,false,1,false); books.item(1).saveAs(excelFileName); excel.quit() ; }