AX 2012 – X++ Code to ‘Create and Post Purchase Order Invoice’

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 order purchTable.initFromVendTable(vendTable); axPurchTable = axPurchTable::newPurchTable(purchTable); axPurchTable.parmPurchaseType(PurchaseType::Purch); axPurchTable.parmDocumentStatus(DocumentStatus::PurchaseOrder); axPurchTable.parmAccountingDate(systemDateGet()); axPurchTable.parmDeliveryDate(01\06\2012); axPurchTable.parmPurchStatus(PurchStatus::Backorder); axPurchTable.doSave(); //Create PurchLine for…

Understanding Axd class and prepareForSaveExtended Method in AIF document service

Hi All, Challenge in AIF document service gonna be understanding the prepareforsaveextended method, this is a key method where we make changes for assigning values from the parent datasoruces or writing our own logic removing he standard code for example inserting the party records.. Here we have 4 RecordprocessingContests.. They are BeforeAnyChildRecordsProcessed BeforeChildRecordProcessed AfterAnyChildRecordProcessed AfterAllChildRecordsProcessed…

Updating a Sales order in AX 2012 AIF

Hi all, When we need to update salesorder, infact any other table we need to specify entity action properly. When i am updating use the below entity action for the salestable. salesTable.action = AxdEnum_AxdEntityAction.update; salesTable.actionSpecified = true; And for sales Line, When you are updating the existing Line use below syntax. salesLine.action = AxdEnum_AxdEntityAction.update; salesLine.actionSpecified…

Invalid entity action error in AIF while updating.

The following code sample shows how to update an existing order through AIF from outside Dynamics AX 2012 . Scenario is the we need to update some of the fields at header of Order. public static int UpdatePurchaseOrder(string _purchId, CallContext CallContextObj = null) { try { KeyField keyField = new KeyField() { Field = “PurchId”,…

Changing mandatory fields to nonmandatory in AIF

Hello all, I came across a scenario where i need to make the mandatory fields(required) to nonmandatory in one of the document service. The requirement was Biz dont want to pass few mandatory fields values but they want us to initialize the values to them through number sequences. In this case by default, the schema…