Author: Mohammed Salah

AX 2012 | D365: Post Packing Slip using X++

static void postPackingSlip(Args _args) { SalesFormLetter salesFormLetter; SalesTable salesTable; SalesId salesId = ‘SO00001’; System.Exception error; str strError; CustPackingSlipJour custPackingSlipJour; ; ttsBegin; try { salesTable = SalesTable::find(salesId); if (salesTable && salesTable.SalesStatus == SalesStatus::Backorder) { salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip); salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No); if (salesFormLetter.parmJournalRecord().TableId == tableNum(custPackingSlipJour)) { custPackingSlipJour = salesFormLetter.parmJournalRecord(); info(strFmt(‘New Packing Slip #:%1…

AX 2012 | D365: Post Sales Invoice using X++

static void postSalesInvoice(Args _args) { SalesFormLetter salesFormLetter; SalesTable salesTable; SalesId salesId = ‘005063’; System.Exception error; str strError; CustInvoiceJour custInvoiceJour; ; ttsBegin; try { salesTable = SalesTable::find(salesId); if (salesTable && salesTable.SalesStatus == SalesStatus::Delivered) { salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice); salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No, NoYes::Yes); if (salesFormLetter.parmJournalRecord().TableId == tableNum(CustInvoiceJour)) { custInvoiceJour = salesFormLetter.parmJournalRecord(); info(strFmt(‘Sales Order #:%1…

[D365] How to add a custom report type to print management setup X++

The simple way to add new report or new design of existing report in Print management Step-1 Create new class SLD_DemoSample Step-2 Find class PrintMgmtDocType in Application Explore and open in designer Step-3 find the delegate in PrintMgmtDocType class  Delegate name is  getDefaultReportFormatDelegate Step-4 Subscribe the event of above highlighted event in the newly created class Step-5 Now add the…

Event handler wihle processReport DP X++

class SalesConfirmDPEventHandler { [PostHandlerFor(classStr(SalesConfirmDP), methodStr(SalesConfirmDP, processReport))] public static void SalesConfirmDP_Post_processReport(XppPrePostArgs args) { MCRCustPaymTable custPaymTable; SalesConfirmDP dpInstance = args.getThis() as SalesConfirmDP; SalesTable salesTableLocal; MCRCustPaymTableTmp custPaymTableTmp; custPaymTableTmp = dpInstance.getMCRCustPaymTable(); salesTableLocal = SalesTable::find(dpInstance.parmCustConfirmJour().SalesId); while select custPaymTable where custPaymTable.RefTableId == salesTableLocal.TableId && custPaymTable.RefRecId == salesTableLocal.RecId { custPaymTableTmp.clear(); custPaymTableTmp.initValue(); custPaymTableTmp.TenderTypeId = custPaymTable.TenderTypeId; custPaymTableTmp.TenderTypeName = custPaymTable.displayName(); custPaymTableTmp.Amount = custPaymTable.Amount; custPaymTableTmp.insert(); }…

Severity Code Description Project File Line Suppression State Error An error occurred while deploying the report EEMCVendInvoiceDocument.ReportMY, EEMCModel. This might be because the SQL Server Reporting Services has not been installed, or is not configured correctly. D365

You probably renamed your VM. Open “Reporting Services Configuration Manager” (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SQL Server 2016\Configuration Tools). Click on the database icon on the left, and click on change database -> Choose an existing database, you will be prompted to connect to the database server and in the Server Name type your new VM’s name. Then…

Pass Args as record from onclick event handler to menu item D365fo [X++]

/// <summary> /// /// </summary> /// <param name=”sender”></param> /// <param name=”e”></param> [FormControlEventHandler(formControlStr(DocuView, Print), FormControlEventType::Clicked)] public static void Print_OnClicked(FormControl sender, FormControlEventArgs e) { Args args = new Args() ; DocuRef _DocuRef ; FormRun _formRun = sender.formrun() as FormRun ; FormDataSource _ds ; _ds =sender.formRun().dataSource(1); _DocuRef = _ds.cursor(); args.record(_DocuRef); // calling menu item new MenuFunction(identifierstr(DocuViewPrint), MenuItemType::Action).run(args); }