Skip to main content

Posts

Showing posts from May, 2012

QueryRange fucktions

i. SysQuery::value(); ii. SysQuery::valuenot(); iii. SysQuery::valueEmptyString() iv. SysQuery::valueNotEmptyString() v. SysQuery::range() vi. SysQuery::findOrCreateRange(…) vii. QueryRange() viii. QueryValue()

Dialog formunda lookup metodu

void Fld1_1_Lookup() { SysTableLookup sysTableLookup; Query query = new Query(); QueryBuildDataSource qbds; ; control = dialog.formRun().controlCallingMethod(); sysTableLookup =SysTableLookup::newParameters(tableNum(LedgerJournalTrans), control); sysTableLookup.addLookupfield(fieldNum(LedgerJournalTrans, RecId)); sysTableLookup.addLookupfield(fieldNum(LedgerJournalTrans, JournalNum)); sysTableLookup.addLookupfield(fieldNum(LedgerJournalTrans, AccountType)); sysTableLookup.addLookupfield(fieldNum(LedgerJournalTrans, AccountNum)); sysTableLookup.addLookupfield(fieldNum(LedgerJournalTrans, txt)); qbds = query.addDataSource(tableNum(LedgerJournalTrans)); //isterseniz range ekleyebilirsiniz //qbds.addRange(fieldNum(LedgerJournalTrans,TransDate)).value(queryValue(dialogTransDate.value())); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }

SQL ile recid

print '** BEGIN **' declare @TABID int, @nextval bigint, @lastUsed bigint, @sql NVARCHAR(4000), @msgName varchar(250), @tablename varchar(250) DECLARE loopTrough CURSOR FOR select TABID, NEXTVAL from systemsequences where systemsequences.Name = 'SEQNO' and systemsequences.DATAAREAID = 'dat' and systemsequences.TABID > 0 open loopTrough FETCH next FROM loopTrough INTO @TABID, @nextval WHILE @@FETCH_STATUS = 0 BEGIN set @tablename = isnull((select [SQLNAME] from SQLDICTIONARY where SQLDICTIONARY.FIELDID = 0 and SQLDICTIONARY.TableId = @TABID), '') if @tablename <> '' set @msgName = @tablename + '(No. ' + convert(varchar(20), @TABID) + ')' else set @msgName = '(No. ' + convert(varchar(20), @TABID) + ')' print 'Analyze ' + @msgName + ' ...' IF @tablename <> '' and EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TY

TempDB

ALTER DATABASE TempDB ADD FILE (NAME = tempdb2, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb2.ndf', SIZE =256) ALTER DATABASE TempDB ADD FILE (NAME = tempdb3, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb3.ndf', SIZE =256)  ALTER DATABASE TempDB ADD FILE (NAME = tempdb4, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\tempdb4.ndf', SIZE =256)

sql server Temp DB move

use master go Alter database tempdb modify file (name = tempdev, filename = 'E:\Sqltemp\tempdb.mdf') go Alter database tempdb modify file (name = templog, filename = 'E:\Sqltemp\templog.ldf') go Alter database tempdb modify file (name = tempdb2, filename = 'E:\Sqltemp\tempdb2.mdf') go Alter database tempdb modify file (name = tempdb3, filename = 'E:\Sqltemp\tempdb3.mdf') go Alter database tempdb modify file (name = tempdb4, filename = 'E:\Sqltemp\tempdb4.mdf') go

Finding unused labels in Dynamics Ax 2009

The pain of unused labels is felt when you start translating your application to support the global versions. As we were porting our application to German we were seeing every possible way to speed up the translation work, one of it was to avoid translating unused labels.  So we tried a few tools that helps us identify this but unfortunately nothing turned helpful. We then resorted to invent our own strategy …. I’m just reposting what my colleague had already posted on his blog with little more detail and a few additions … *This job works only if your cross reference is updated* static void FindUnUsedLabels() {     str 50          labelId;     str             labelString;     int             i;     //set max label to the highest number of labelId in your application     int             maxLabel = 2000;     xRefNames       names;     XRefReferences  ref;     ;     while (i <= maxLabel)      {         //Sequential generation         labelId = "@IFC" + int2str

Twenty must know tips before ERP Implementation

Recently i was reading through one of the ERP reports from Panorama Consulting. I found these twenty points an interesting read for anybody working with ERP. Give it a quick read and you might also like it. To access the entire report click here http://panorama-consulting.com/Documents/2011-Guide-to-ERP-Systems-and-Vendors.pdf

Common problem in Printing AX Reports as a file using Batch job scheduling through code in the Server File System

The solution is pretty simple and is as follows: As AX batch job scheduling always runs on the server, the below configuration has to be followed: (i) E nable AOS printing on the AOS server configuration (see below). Do not restart the AOS yet. (ii) D ue to a bug in the Configuration Utility, we need to manually update the corresponding value in the registry. In this path-> HKEY-LOCAL MACHINE->SOFTWARE->MICROSOFT->DYNAMICS-5.0->Configuration->Original search for the Name useserverprinters and set the value to “1”. After that restart the AOS. (iii) Provide an UNC Path on the AOS computer that will used for saving the PDF Files (temp. only). Now you can print the AX reports as a pdf, rtf,txt or any other valid format through code(x++) from batch job scheduling.

How to use COM Wrapper dll in AX

(i) Install the COM Wrapper DLL Files, into the bin directory of the AOS. (ii) Register it with the following Command, %WINDIR%\Microsoft.NET\Framework\v2.0.50727\regasm.exe Test.Wrapper.DLL /tlb:Test.Wrapper.tlb (iii) Now, After Successful Registration, Follow the below path and click on COM Class Wrapper Wizard.i.e., Tools->Development tools->Wizards->COM Class Wrapper Wizard (iv) On the first Page of the Wizard, Click Next Button (v) Select the installed Wrapper and then click Next Button. (vi) Then give some string as an element mask and then click finish. Now, you can see that all the classes created in the wrapper dll will be present in the AOT. Just directly use those class/classes in your code. Things to remember while you call this class : As the Wrapper DLL has been registered in the AOS, So the methods in the extracted classes have to be called from the methods of classes whose run on property is server.

Print Sales Invoice Report in PDF / HTML / RTF / ASCII etc., format through code

SalesFormLetter salesFormLetter; PrintJobSettings printJobSettings; CustInvoiceJour custInvoiceJour; SalesId salesId; #File   salesid = "SO-100010"; salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice,false); printJobSettings = new PrintJobSettings(); printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat); printJobSettings.fileName( '//10.0.57.22/AOSPrintShare//' + salesId+#pdf ); printJobSettings.warnIfFileExists(false); SalesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select custInvoiceJour where custInvoiceJour.SalesId == salesId; custInvoiceJour.printJournal(salesFormLetter);

calculate total sales order or sales quotation amount / discounts / tax etc., through code( X++ ) in AX

I have seen that few developers have a problem in getting the total Sales order amount or sales quotation amount with Tax /discounts etc., in the preferred currency before invoicing because these are not stored into any specific tables. The below form shows, where we can see the sales totals, Accounts Receivable->Sales Order-> Inquiries Menu->Totals   Now, this can be achieved through code using SalesTotals class. Check out the below code snippet. SalesTotals   salesTotals; SalesTable   salesTable; container   displayFields; str     totalTax, amountWithoutTax, amountInclTax; salesTable = salesTable::find('SO-1112345'); salesTotals = SalesTotals::construct(salesTable, salesUpdate::All); salesTotals.calc(); displayFields = salesTotals.displayFieldsCurrency( salesTotals.currencyCode() ); amountWithoutTax = conpeek(displayFields, TradeTotals ::posBalance()); amountInclTax   = conpeek(displayFields, TradeTotals::posTotalAmount()); totalTax    = conpee

address tables

DirPartyAddressRelationShip                dirPartyAddressRelationShip; DirPartyAddressRelationShipMapping dirPartyAddressRelationShipMapping; Address address; ; select firstonly * from DirPartyAddressRelationShip join  dirPartyAddressRelationShipMapping join address order by  DirPartyAddressRelationShip.Shared desc,  DirPartyAddressRelationShip.IsPrimary desc                         where DirPartyAddressRelationShip.PartyId == VendTable::find(vendPAckingSlipJour.OrderAccount).PartyId && dirPartyAddressRelationShipMapping.PartyAddressRelationshipRecId == dirPartyAddressRelationShip.RecId && address.RecId == dirPartyAddressRelationShipMapping.AddressRecId && address.type == AddressType::Service; DirPartyAddressRelationShip table ties source table with (s

empty InventDimId

InventDimId is a mandatory field for some tables. If you don't use it, you can left it blank: Ssss.InventDimId = InventDim::inventDimIdBlank();

Query: empty records, not empty records, use enum at query value

Not empty records: qbds.addRange(fieldnum(custtable,name)).value(sysquery::valueNotEmptyString()) ; Empty records: qbds.addRange(fieldnum(custtable,name)).value(sysquery::valueEmptyString()) ; Records are not equal 10000: qbds.addRange(fieldnum(custtable,accountnum)).value(sysquery::valueNot("10000") ) ; Ranges: qbds.addRange(fieldnum(custtable,accountnum)).value(queryrange("1","10000") ) ; Enum: qbds.addRange(fieldnum(B_RMARequestTable, RefType)).value(queryvalue(B_RMAReqRefType::RepairJournal));

modified method sometimes works twice

If combobox value selected with lookup and there is a data source refresh in method modified, modified method works twice. public void modified() { ; super(); info("test"); salesLine_DS.research(true); salesLine_DS.refresh(); info("tested"); } I found a solution for that and applined mine. I put a variable at class declaration method and: public void modified() { ; super(); if (hasChanged) //for twice call bugfix. return; hasChanged=true; info("test"); salesLine_DS.research(true); salesLine_DS.refresh(); hasChanged=false; info("tested"); }

AXAPTA refreshing records

repairjournal_ds.research(); repairjournal_ds.refresh(); If you want to stay at current record: repairjournal_ds.research(true); repairjournal_ds.refresh();

AXAPTA - Using common DLL

Put your DLL file at Client\Bin at Axapta folder under Program Files. That folder's name is : C:\Program Files (x86)\Microsoft Dynamics AX\50\Client\Bin\ at my PC. Set parameters with extTypes enum at Arg method. Sample usage: void Test() { DLL testDll; DLLFunction test; ; testDll = new DLL("MyTestDLL.dll"); test = new DLLFunction(printDLL, "MyTestingMethod"); test.arg(extTypes::Word ,extTypes::String); test.call(12345,"ABCDE"); }

Reading Data through SQL Data Reader in AX 2009

static void CheckDatabaseConThroughDotNet(Args _args) { System.Data.SqlClient.SqlConnection con; System.Data.SqlClient.SqlCommand com; System.Data.SqlClient.SqlDataAdapter da; System.Data.SqlClient.SqlDataReader dr; System.Data.DataSet ds; str _vendName; ; try { con = new System.Data.SqlClient.SqlConnection(strfmt("Data Source=Ibrahim; Initial Catalog=DynamicsAx; Integrated Security=true")); com = new System.Data.SqlClient.SqlCommand("Select * from VendTable",con); con.Open(); dr = com.ExecuteReader(); while(dr.Read()) { // _vendName = dr(0); } con.Close(); } Catch(Exception::Error) { info("error in Error Class"); } Catch(Exception::CLRError) { info(CLRInterop::getLastException().ToString()); } }

Understanding the Settlement Mechanism in Microsoft Dynamics AX

Understanding the Settlement Mechanism in Microsoft Dynamics AX Settlement is an accounting transaction that occurs on accounts payable, accounts receivables, and general ledger. This transaction is used mainly for settling vendor invoices against vendor payments or advanced payment, and customer invoices against customer collections or advanced collection. Settlement could occur on general ledger transactions as well. It is necessary to classify posting profiles of the vendor and customer in the opening balance since it will affect the settlement process. The settlement transaction affects vendor and customer balances, and it is reported in the vendor or customer statement report that identifies the following: Vendor The open (unsettled) invoice and payments The closed (settled) invoiced and payments Vendor balance Customer The open (unsettled) invoice and collections The closed (settled) invoiced and collections Customer balance A settlement transaction could occur during a payment o

how to remove reserv

// Code is added to InventJournalTable methods void removeAllJournalLinesReservation() { InventUpd_Reservation res; InventMovement inventmovement; Inventtrans inventtrans; InventJournalTrans inventJournalTrans ; if(this.Posted) return; while select inventJournalTrans index hint LineIdx where inventJournalTrans.JournalId == this.JournalId { while select inventTrans index hint TransIdIdx where inventTrans.InventTransId == inventJournalTrans.InventTransId && (inventTrans.StatusIssue == statusIssue::ReservOrdered || inventTrans.StatusIssue == statusIssue::ReservPhysical) { inventmovement = inventTrans.inventmovement(true); res = InventUpd_Reservation::newInventDim(inventmovement,inventTrans.inventDim(),abs(inventTrans.Qty),true); res.updatenow(); } } }

How to check the number of marked records on the Forms

Scenario 1: User is checking the rows in the grid to mark them for deletion, I want to get the number of checked records to do some thing Solution Use the buffer_Ds.recordsMarked().lastIndex() to check the number of the records that are marked for deletion. Scenario 2: User has marked the multiple records for deletion on the Form, now I want to do some manipulation on the deletion and refresh the Grid or the Form. What should I do Solution: Never write the research code in the delete method because the delete method on the Form is called per row and calling research would break this behavior, since research calls the executeQuery(). DeleteMarked() is the good place to write the research code since it is called once if there are multiple records, you should write the research code just after the super() call. Note: The deleteMarked() method is not called when there is a single record for the deletion.

Dynamics AX Event IDs

http://blogs.msdn.com/b/axinthefield/archive/2011/03/01/dynamics-ax-event-ids.aspx Recently a fellow PFE compiled a list of the AX Event IDs with their description and a possible action. This post is intended to give end users a better idea of the messages generated by the AOS service within the Application Event Log within the Windows Event Viewer. If you are receiving messages, it may be necessary to contact the Dynamics AX Support Team at Microsoft for more assistance as this may be an indication of more serious troubles in the system. Error and Warning Messages The messages in the following table can be informational only, but often are a result of an issue within the Dynamics AX application. They do may require user action. ID Message text Description Action 103 Microsoft Dynamics AX 2009 – The control handler not installed The Microsoft Dynamics AX Server Manager could not initialize the control handler. Can be caused by failed system setup. The registration of the AOS

Generation of CodePage using X++

Case Study: In this demo scenario, we are going to build Windows Code page using X++ class. For this project, I have build a generation class which basically returns the list of available codePage. private void buildCodePage() { System.Text.EncodingInfo[] encodingInfoArray; System.Text.EncodingInfo encodingObject; RecordInsertList recordInsertList = new RecordInsertList(tableNum(CodePageTable)); System.Exception ex; InteropPermission permission = new InteropPermission(InteropKind::ClrInterop); ; // Clear always the codePage data is available delete_from codePage; try { permission.assert(); encodingInfoArray = System.Text.Encoding::GetEncodings(); // BP Deviation Documented. for (i = 0; i <= CLRInterop::getAnyTypeForObject( encodingInfoArray.get_Length()) - 1;

Comparing AX and Active Directory User Accounts

metod 1 I was recently working with an AX 2009 customer who wanted to compare the user accounts configured in AX with the user accounts in Active Directory. The basic goals were: 1.Find all AX user accounts that no longer exist in Active Directory. 2.Find all accounts that are disabled in Active Directory but not in AX. It would be great if AX would flag these scenarios for you, but unfortunately it doesn't. If you’re interested in knowing if you have any orphaned accounts or accounts that should probably be disabled in AX, here’s a quick way to do just that. 1.Export AD users to a CSV file. I used a PowerShell command for this step. The command I used requires the Active Directory Module for Windows PowerShell. This is installed by default on domain controllers, but it is also available via the Remote Server Administration Tools for Windows 7 if you want to run it from a workstation instead. http://www.microsoft.com/download/en/details.aspx?id=7887 2.Create a table for the AD

How to convert from date to string using x++ in ax 2009 ?

void DateTStringConvert() { date today=today(); str TodayDate; ; TodayDate = date2str( today,321,DateDay::Digits2,DateSeparator::Slash,DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4); info(TodayDate ); } Note : The function date2str take following parameters : 1- the date . 2- the date style dmy or ymd or....etc . 3- number of digits for day . 4- separator 5- number of digits for month. 6- separator 7- number of digits for year

How to Truncate Table from AX 2009?

1- go to the administration module 2- go to periodic menu 3- choose the SQL administration 4- choose the table you want truncate it from the all table collapse 5- click on the table action button 6- select truncate 7- click OK

How to Rename the Form In AX 2009 Using X++ Code?

when you create any new form in AX you need to Rename it as your business need to rename any form in AX do the following : 1- in form methods override the init method 2- write this line of code : element.design().caption("Payment"); //////////////////////////////////////////////////////////////////////////////// Example: public void init() { super(); element.design().caption("Payment"); } in caption between double quotation put any name you want

Easy way to get sid

Most of the time when we switch back and forth from staging to production environment, we want to get the SID for the current user setting, here are the steps you can perform to scussfully logon to Dynamics AX: 1. Open the command prompt and type "wmic path win32_useraccount where name="{Domain user name}" get sid" 2. Copy the SID. 3. Open the SQL server and write following command to update current admin user: use {AX DB} update USERINFO set SID = '{paste the SID here from step#2}', NETWORKDOMAIN='{Network domain}', NETWORKALIAS='{User Id}' where ID='Admin'

Upgrade Dynamics AX 4.0/AX 2009 to Dynamics AX 2012

Setup source Environment 1. Import the PreProcessing (databaseupgrade\xpo\UpgradeAX5.xpo) XPO, located in the installation CD folder and Un check "Import with ID values:" 2. Open the PreProcessing Checklist "SysCheckList_PreUpgrade50" located in the AX50PreUpgradeFramework project. 3. The Preprocessing Checklist appears, if your checklist has this @ABC123 instead of text, and then do this to get the missing label file. To apply the new label files in your AX4/5 machine (if you are working with preprocessing framework): · Copy the label file to the label folder in your AX4/2009 machine · Restart the AOS · Label folder in AX4/2009 is a sub folder under ...\Application\Appl\ where you can find *.ald files in it. 4. Run through the PreProcessing Checklist Items to prepare the database for Upgrade · If upgrading AX 2009, and the upgrade scripts don't run after opening the cockpit, jump to step #12 and follow the

Dynamics AX - code to Read/Write data to excel

Writing Data to Excel file How it works 1. Use SysExcelApplication class to create excel file. 2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by default 3 worksheets will be available). 3. Use SysExcelWorkSheets to select worksheet for writing data. 4. SysExcelCells to select the cells in the excel for writing the data. 5. SysExcelCell to write the data in the selected cells. 6. Once you done with write operation use SysExcelApplication.visible to open file. static void Write2ExcelFile(Args _args) { InventTable inventTable; SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; SysExcelCell cell; int row; ; application = SysExcelApplication::construct(); workbooks = application.workbooks(); workbook = workbooks.add(); worksheets = workbook.worksheets(); worksheet = worksheets.itemFromNum(1); cells = worksheet.cells(); cells.range('A:A').nu

Changing the language at runtime in X++

In the setSetup method of the SysUserSetup form within the if clause add the following: if (infolog.language() != userinfo.language) { infolog.language(userinfo.language); infolog.navPane().loadStartupButtons(); }

How to select Distinct Using X++?

public void lookup(FormControl _formControl, str _filterStr) { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(MBSR_ACC_PATIENTS), _formControl); Query query = new Query(); QueryBuildDataSource queryBuildDataSource; ; sysTableLookup.addLookupfield(fieldnum(MBSR_ACC_PATIENTS, ACCOUNT_NO)); sysTableLookup.addLookupfield(fieldnum(MBSR_ACC_PATIENTS, ACCOUNT_NM)); queryBuildDataSource = query.addDataSource(tablenum(MBSR_ACC_PATIENTS)); queryBuildDataSource.addSortField(fieldnum(MBSR_ACC_PATIENTS, ACCOUNT_NO)); queryBuildDataSource.addSortField(fieldnum(MBSR_ACC_PATIENTS, ACCOUNT_NM)); queryBuildDataSource.orderMode(ordermode::GroupBy); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); super(_formControl, _filterStr); }

Dynamics AX2009 – Useful utility “SysQueryRangeUtil”

In AX 2009 there is utility through whihc we can provide arguments/ placeholders for field values in Select query whicle processing reports or filtering data in an inquiry form. There are following functions for use in AX2009 in Select query as an argument for field values.. e.g. to use the current employee’s ID as an argument use the following in the “Employee” field in Select query filter. In the following screenshot we are trying to fetch the Project Journals posted by the employee ID attached the current user so that user can see their own journals only. class SysQueryRangeUtil Run On :Called Methods Method Description cancelTimeOut Cancels a previous method call to the Object::setTimeOut Method. (Inherited from Object.) equal Determines whether the specified object is equal to the current one. (Inherited from Object.) getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from

Cross Company Query

Sometimes we need to fetch data from several companies. Straight forward way is to use a crossCompany keyword in a select statement: container conCompanies = ['cee', 'cec', 'ceu']; while select crossCompany : conCompanies * from CustTable { ... } More elegant and flexible method to select cross company would be to use a query with a parameter AllowCrossCompany set to Yes. This parameter enables additional tab in a query selection dialog which allows user to select companies. In the same manner cross-company fetch of data can be done in X++: static void crossCompanyQuery(Args _args) { Query q = new Query(); QueryBuildDataSource qbds; QueryRun qr; CustTable ct; Container con; ; qbds = q.addDataSource(tableNum(CustTable)); qbds.addSortField(fieldNum(CustTable, dataAreaId)); // by default adds all companies to which current user has access rights q.allowCrossCompany(NoYes::Yes); //q.addCom

crosscompany

Metod 1; container conCompanies; while select dataArea where !dataArea.isVirtual { conCompanies += [dataArea.id]; } while select crosscompany : conCompanies inventTable { // ... do something ... } metod 2; public Query buildQuery() { Query query = new Query(); QueryBuildDataSource qbds; DataArea dataArea; ; query.allowCrossCompany(true); while select dataArea where !dataArea.isVirtual { query.addCompanyRange(dataArea.id); } qbds = query.addDataSource(tablenum(InventTable)); qbds.addRange(fieldnum(InventTable, ItemId)); qbds.addRange(fieldnum(InventTable, PrimaryVendorId)); return query; } metod 3; DataArea dataArea; ; while select dataArea where !dataArea.isVirtual { changeCompany(dataArea.id) { // ... do something ... } }

Pass Query from dialog to Form and Filter records

Created a Runbase class which has dialog selection using QueryStr. I need to pass this Query range selection to a form and need to filter records based on this query Selection. Call the form by passing the Query selection from the class Args _args; FormRun _formRun; EmplId _empId; ; _args = new Args(); // creating a object for args class _args.name(formstr(xtgCummeInquiry)); // Form Menuitem _args.caller(this); // Form Caller(Current Form is mentioned as this) _args.object(CummeQueryRun.query()); _formRun = ClassFactory.formRunClass(_args); //new FormRun(_args); // Creating object for FormRun _formRun.init(); // Form Initialization for Load _formRun.run(); // Form Run for process _formRun.wait(); // Form Wait for Display and from the called form run method,assign the Query range value to the form datasource public void run() { boolean ret; Query q; DictField dictField; str

Send message to online user in Dynamics AX

static void sendAlert(Args _args) { EventInbox inbox; EventInboxId inboxId; inboxId = EventInbox::nextEventId(); inbox.initValue(); inbox.ShowPopup = NoYes::Yes; inbox.Subject = "Message to online user"; inbox.Message = "Message you want to send to user"; inbox.SendEmail = false; inbox.UserId = curUserID(); inbox.InboxId = inboxId; inbox.AlertCreatedDate = systemdateget(); inbox.AlertCreateTime = timeNow(); inbox.insert(); }

To schedule your batch job

1.In the AOT, right-click the Jobs node, and then select New Job. 2.In the Editor window, enter the X++ code shown in the following example, and then save the changes. 3.In the Editor window, press F7 to compile your job, and then press F5 to run your job. Note The result of your job is that your batch is scheduled to run. X++ static void Job_ScheduleBatch2(Args _args) { BatchHeader batHeader; BatchInfo batInfo; RunBaseBatch rbbTask; str sParmCaption = "My Demonstration (b351)"; ; rbbTask = new Batch4DemoClass(); batInfo = rbbTask .batchInfo(); batInfo .parmCaption(sParmCaption); batInfo .parmGroupId(""); // The "Empty batch group". batHeader = BatchHeader ::construct(); batHeader .addTask(rbbTask); batHeader .save(); info(strFmt("'%1' batch has been scheduled.", sParmCaption)); } 4.Click the Build menu, and then click Generate Incremental CIL. This CIL build is necessary because bat

Bir kayıt için rapor yazdırma / Call a report from a spesific record

//rapor belli bir kayıt için çağırmak istendiğinde yazılacak kod //code block to call a report from a spesific record //init içne yazılacak //embed into init section // teklif tablosunda bir kayıt için örnek //example for a quotation record { smmQuotationTable callersmmQuotationTable; QueryBuildDataSource qbds; ; sysReportRun::getRunbaseReport(this).getLast(); if (element.args().caller()) { if (! element.args().record().recId) throw error(strFmt("@SYS22338",funcName())); switch (element.args().dataset()) { case tablenum(smmQuotationTable): callersmmQuotationTable = element.args().record(); break; default: throw error(strFmt("@SYS23396",funcName())); } } if (callersmmQuotationTable.QuotationId) { qbds = element.query().dataSourceTable(tablenum(smmQuotationTable));

Raporda nesne erişimi / Access to object in report

//nesnenin oto tanımlama özelliği aktive edilirse doğrudan ismini kullanarak erişilebilirsiniz. //you can access to object with its name, if you activate autodecleration property. //Oto tanımlama yapmadan bir nesnenin özellğini kullanmak için AOT yapısından faydalanılabilir. //you can access to object Without Aoutodecleration property using AOT this.design("ReportDesign1").sectionName('ReportHeader').controlName("DispField").delete(); this.design("ReportDesign1").sectionName('ReportHeader').controlName("DispField").hide();

Excel Export

static void exportVendorToExcelTEST1(Args _args) { SysExcelApplication SysExcelApplication; SysExcelWorksheet SysExcelWorksheet; SysExcelWorksheets SysExcelWorksheets; SysExcelWorkbooks SysExcelWorkbooks; SysExcelWorkbook SysExcelWorkbook; SysExcelRange SysExcelRange; SysExcelCell SysExcelCell; SysExcelCells SysExcelCells; COMVariant COMVariant1; Kriterler kriterler; VendTable vtab; Dialog dialog = new Dialog(); DialogField dflItem = dialog.addField(typeid(VendAccount)); #excel ; while select vtab where vtab.AccountNum like "S0000*" { try { sysExcelApplication = SysExcelApplication::construct(); sysExcelApplicatioN.displayAlerts(FALSE); sysExcelApplication.visible(FALSE); sysExcelWorkbooks = sysExcelApplication.workbooks(); // for filename sysExcelApplication.workbooks().open("C:\\"+vtab.AccountNum+".XLS"); sysExcelWorkbook = sysExcelApplication.workbooks().item(1); SysExcelWorksheets = sysExcelWorkbook.worksheets(); SysExcelWorksheet = SysExcelWorksheets.

Cross Company - Part 1

First of all, let’s describe the default behavior the AX kernel takes when a cross company query is issued. Here is an example of a cross company query: static void CrossCompanyTest(Args _args) { Address address; container conCompanies = [ 'a0', 'a1', 'dat' ]; ; while select crossCompany :conCompanies address order by dataAreaId return; } Cross company queries in Dynamics AX 2009 will include an IN list of DATAAREAIDs: SELECT … FROM ADDRESS A WHERE A.DATAAREAID IN (?,?,?) ORDER BY A.DATAAREAID

Ax Database Configuration Checklist part 1

Welcome to the Dynamics Ax Performance Team's blog. We're putting together a team introduction and hope to have it posted within the next week or so. The first entries will discuss SQL Server 2005 configuration and Best Practices for Dynamics Ax, but we'll be covering a much wider range of topics over the coming months, such as Dynamics AOS configuration, X++ profiling, and leveraging new features of SQL Server 2008. My name is David Reinhold and I specialize in SQL Server database and BI performance. I spent nine years in Microsoft Consulting Services (MCS) practice before joining the Ax Performance Team in December, 2007. Here is the Part 1 of the Database Configuration Checklist, covering configuration of: Operating System performance settings, SQL Server 2005/2008 Service configuration, and SQL Server 2005/2008 Instance configuration (updated to include special considerations for Windows Server 2008). The format of the Checklist includes instructions on How to che