Skip to main content

Posts

How to get Country Name by Country code for Sales order in Ax 2012

To  get Country Name by Country code for Sales order in Ax 2012 you can try below code. LogisticsAddressCountryRegionTranslation::find (LogisticsPostalAddress::findRecId (salesTable.DeliveryPostalAddress).CountryRegionId,'EN-US').ShortName Like code is SAU then if you want to display name of SAU as Saudi Arabia then you need to find it from LogisticsAddressCountryRegionTranslation table .

Hide dialog for SSRS Report in ax 2012

To Hide dialog for SSRS Report in ax 2012 you need to go to controller class and follow below steps. Go to Controller class then go to  main method of class. Find  statement : Controller.startOperation(); then specify the below statement to hide dialog box which used for range selection. Controller.parmShowDialog(false); To show dialog you can pass value true instead of false.

Code to call Display method in Workflow class in Ax 2012

If you want to show display method of table in workflow designer then you need to write method on table and class . For example table method to get customer credit limit value. display AmountMST Cust_CreditLimit() { ; return CustTable::find(this.CustAccount).CreditMax; } Then go to document class for e.j. \Classes\PurchTableDocument and create new method like this. public AmountMSTParmCreditLimit(CompanyId _companyId, TableId _tableId, RecId _recId) { CustTable CustTable; select CustTable where CustTable.recid==_recId; return CustTable.Cust_CreditLimit(); }

Code to get date time difference in ax 2012

This is a sample example to get date time difference in ax 2012 TransDateTime dateTime_a, dateTime_b; date date1, date2; int64 c; #define.NoOfHrsInADay(24); dateTime_a= 2014-09-26T11:59:59; dateTime_b= 2014-09-19T08:50:50; c = DateTimeUtil::getDifference(dateTime_a,dateTime_b); date1 = DateTimeUtil::date(dateTime_a); date2 = DateTimeUtil::date(dateTime_b); c = c - (date1-date2)*(#NoOfHrsInADay)*60*60; info(strFmt("%1 day, %2 hrs.",(date1-date2), c div 3600)); Output will be like this:-7 day, 3 hrs. I hope it will help you in your date  time troubleshooting.

Code to Create On Account Transaction for Project in Ax 2012

Path for On Account Transaction for Project is as below. Project management and accounting/Common/Projects/All projects/  On Account Transactions This is Code sample to Create On Account Transaction for Project in Ax 2012. You need to declare required variables. _ProjTable =ProjTable::find(_projId); projOnAccTrans.clear(); projOnAccTrans.ProjID = _projId; projOnAccTrans.TransDate = _str2Date("3/11/2015",123); projOnAccTrans.editTransactionOrigin(true,ProjOriginOnAcc::Milestone); projOnAccTrans.Description = _Description; projOnAccTrans.CurrencyId = _Currency; projOnAccTrans.TotalSalesAmountCur = _SalesPrice; projOnAccTrans.TransId = ProjParameters::newTransId(); projOnAccTrans.Qty=_Quantity; projOnAccTrans.DefaultDimension=_ProjTable.DefaultDimension; projOnAccTrans.projInvoiceStatus(); projOnAccTrans.insert

Finalization of Purchase order if PO is not in invoiced status Ax 2012

You can use following steps for Finalization of PO . Check the Status of the Purchase Order(PO) of Purchase Order is with approval status Confirmed & PO status ‘Invoiced’ than you can finalized directly but if its not invoiced then you can use below steps. You need to do change request for workflow Click on ‘Request Change’. Then Cancel the ‘Deliver Remainder’ for all the items in the Purchase Order. Then Submit the Purchase Order for Workflow approval. Then Make the Purchase Order ‘Approved’ Then Confirm the Purchase Order. After above step now you can Finalize the Purchase Order.

Number sequence gap issues for Orders in Ax 2012

Some time we noticed that there is Number sequence gap issues for Orders in Ax 2012 like you have created SO00001 then after sometimes you created then you got order SO00004 is creating instead of SO00002. Reason for this kind of issue is as follow. 1.If you check to number sequence type then you will find that a continuous number sequence could be setup as Order. 2. If you create a new order and then delete it, no numbers added to the status list which can be freed and used again system maintain itself. 3. If you create a new order using but then you cancel it for example "Create sales order" form, and click "cancel" in the form then the number will be added to the status list. Then the number can be freed by clean-up and can be used again when a new order is created. I hope you can get Idea from above observation.