Monday, March 7, 2016

Working with AX 7 using VM

         This post based on a question one of my friend posted to me, If you are beginner or working in a company you want to access the dynamics ax 7, but you don't want to spend a penny. I hope most of the people able to access the dynamics AX 7 preview with azure and office 365 account fortunately I was one of them. What if I don't have any support from company or as individual still want to access dynamics ax 7, following steps will help.

  1. Create an Dynamics CRM trial account or office 365 trial account, all those accounts will be expired, but you still have lot of time to play around with dynamics ax 7
  2. Download dynamics ax 7 VHD from following link https://connect.microsoft.com/site1321/Downloads/DownloadDetails.aspx?DownloadID=60417   For download you need FTM application which you can download freely from Microsoft website
  3. Follow below link, This blog explains how you can configure dynamics ax 7 and get access.
      In last step in the blog, you can use your trial accounts created on first step.


Some of the points needs to be noted

You can use this VM in client operating systems like Win7, win 10. you need to enable the hyper-v console from Turn features on or off in control panel.

You need minimum ram size 6 GB,





Thursday, February 11, 2016

Error on deploying SSRS report



Problem: Once we completed all the Dynamics ax installation and configuration. we get into SSRS report deployment. Every setup was correct but we couldn't able to deploy the reports, instead we are getting the following error on management shell as well as event viewer

  1. 1. An error occurred : The specified directory service attribute or value does not exist.If User Account Control (UAC) is enabled on the machine, close the application, right-click the application, and then click Run as administrator.
  2. The deployment was aborted. You do not have privileges to deploy to server: *****. For deployment, you must have administrative rights to the SQL Server Reporting Services (SSRS) server. Contact your administrator to deploy.

Resolution:
We tried everything like, deploying the report directly from AOT, opening the AX with run as administrator as well as management shell. Nothing works. finally, I got the help from Microsoft support team.

Its a simple solution, but which is nowhere related to Dynamics ax box.

the service "Remote Registry" has to be running while deploying the report





Monday, November 23, 2015

Error while creating custom workflow

Problem: One of my colleague recently created a custom workflow (which is not shipped out of the box). he followed the step by step process to create the workflow. when he tries to run the workflow configuration he got the following error.

An unexpected error has occurred while opening the workflow. See the event log on the AOS and contact your system administrator to resolve the issue.

Resolution: ITs a simple resolution, just generate the CIL it will resolve the issue.



The above code requires the CIL for the classes we created.

While you creating the workflow wizard it will warn you for CIL compilation. As you have noticed you will not run into this issue.
 

Sunday, November 1, 2015

Installation of Visual Studio tools on Dynamics AX 2012 R3 CU9



Its been a long time that i have written my last post. I was tied up with some work.

Problem: I was trying to install visual studio tools on Dynamics AX R3 CU9 version. But i was keep getting an error that "Installation package missing".

Solution: I was aware of the compatibility that CU9 works with VS 2013 Update 2 and above but my AX installer package keep giving me a error. So i got to know that VS tools for CU9 missing from my installer package. 

What it means that my installation folder doesnt contain the necessary VS tool files to install it. I downloaded CU9 slipstream file and copy the  folders to my installation folder then no longer i am seeing the error, I am able to install the VS tools. Following link helped me on the process. I hope you find this useful

http://blogs.msdn.com/b/axsupport/archive/2015/04/21/how-to-slip-stream-ax-2012-r3-cu-8.aspx

Dynamics AX community


Saturday, March 8, 2014

Misconception and common guidelines on Dynamics AX 2012 infrastructures


Common misconception on infrastructures
Following points are gathered from the Microsoft training,
It includes some best practices also

1. Virtualization may be the smartest way of handling your infrastructures.
But having DAtabase server on virtualization seriously affect the performance of AX system. It reduces 14.5 % performance down compared to physical servers.

2. Putting more Memory and Processin...g power Wouldnt help if you dont know the sizing   guidelines
For example,
AOS Server Sizing,
5K Lines Per Hour Per Core (usually 4 to 12 core box)
2 GB Memory for Each Core (usually 4 to 8 GB per AOS instance)
User Concurrency is a good Marker. Based on Transaction Complexity, between 50 Users Per Core to 150 Users Per Core (average of 60)

3. Database Thumb rule is 2 to 6 GB memory for each CPU core. Next you have to set SQL Server maximum server memory correctly. Always leave a percentage for OS and other services running on the box
        
                                                                                                                            - to be continued

Friday, January 17, 2014

Total purchase invoice amount through X++

How to get a total invoice amount for a purchase order table, You had to take it in consideration for all the charges calculated (ex: tax). I tried to search the purchtable and purcline table for any existing methods. I found one class called purchtotals. there Microsoft calculating all the total amounts of incoice amount, order amount etc. Her...e is the code for this total calculation

PurchtotalsForm totalsForm;
;
totalsForm = PurchtotalsForm::newPurchTotalsForm(this, 1);
totalsForm.calctotals();
return totalsForm.invoiceAmountValue();

not only you can calculate invoice amount here is the list things you can get it from this class.

purchTaxTotal,
purchRoundOff,
purchTotalAmount,
purchTaxRoundOff,
purchCashDiscDate,
purchPrepayLimit,
purchPrepayAvailable,
purchTaxWithholdTotal

Friday, January 10, 2014

Import retail categories through code in dynamics ax 2012

Simple code to import Retail Product category

 EcoResCategory ecoResCategory
 ; 
 ecoResCategory.clear();
 ecoResCategory.initValue();
 ecoResCategory.initFromParent(EcoResCategory::findByName('HAL',ecoResCategory.CategoryHierarchy);
 ecoResCategory.Code = 'Test_categoryimport';
 ecoResCategory.Name = 'Test_Categoryimport';
 ecoResCategory.addToHierarchy();

import barcode through X++ in dynamics ax 2012

Some simple code for barcode import

 inventItemBarCode.barcodeSetupId = RetailInventTable::find(itemCode).BarcodeSetupId;
 inventItemBarCode.inventDimId = InventDim::findOrCreate(inventDim).inventDimId;
 inventItemBarCode.RetailVariantId = InventDimCombination::find(itemCode,inventItemBarCode.inventDimId).RetailVariantId;
 inventItemBarCode.itemId = itemCode;
 inventItemBarCode.description = InventTable::find(itemCode).defaultProductName();
 inventItemBarCode.UnitID = InventTable::find(itemCode).salesUnitId();
 inventItemBarCode.qty = qty;
 inventItemBarCode.useForInput = NoYes::Yes;
 inventItemBarCode.useForPrinting = NoYes::Yes;
 inventItemBarCode.itemBarCode = barcode;
 if(inventItemBarCode.validateWrite())
 inventItemBarCode.insert();

Partial sales order through code in Dynamics ax 2012 R2

I had been searching the internet to find the code. But i couldnt, every code leads to full invoice or line by line invoice. so i did some exploring to come up with a below code it will invoice partial quantity

I updated the partial sales invoice through code...

 SalesFormLetter salesFormLetter =  SalesFormLetter::construct(DocumentStatus::Invoice);
 SalesTable salesTAble;
 SalesParmLine parmLine;
 ;
 salesTable = SalesTable::find('FUAE-000002');
 salesFormLetter.salesTable(salesTAble);
 salesFormLetter.transDate (systemDateGet());
 salesFormLetter.specQty (SalesUpdate::All);
 //If you want proforma you can enable the code
 //salesFormLetter.proforma (true);
 //salesFormLetter.printFormLetter (true);
 salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.s alesParmUpdate());
 salesFormLetter.initParmSalesTable(salesTAble);

 salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
 salesFormLetter.initLinesQuery();
 while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
 {
 ttsBegin;
 parmLine.DeliverNow = 10;
 parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
 parmLine.setInventDeliverNow();
 parmLine.setLineAmount(); 
 parmLine.update();
 ttsCommit;
 }
 salesFormLetter.run();

Monday, July 22, 2013

Exchange rate update add-on


Problem:
 
I was asked to create exchange rate add-on, It will update the exchange rate from online
  • This update add-on should have the ability to work automatically (without human intervention)
  • Given option to manual update also
  • Average update and Closing rate update for consolidation companies.
Solved: 
There is no inbuilt functionality for exchange rate updating in dynamics AX 2009. Following are the screenshots and functionality of the add-on that I created,
  • Configurable in batch job so that it automatically updates the exchange rate in exchange rate table. 
  • Based on the batch job, it will update the value in exchange rate table.
  • Notifications, errors and warnings will be updated in the log and shown to peoples.
  • Manual update option would be given to end user
  • Staging table : Its the mediator between actual exchange rate table and downloaded data from internet. It also can be viewable from the content pane 

 



If anybody need this add-on contact me on (mdashraf@live.in, india - 919043440941)
It is two hour development cost only

Following are the advantage of deploying this add-on to your company
  • It is automatic and highly customizable by end user
  • Easy deployment package
  • Enhancement can be made according to the customer (within the cost of this add-on)
  • support will be provided at free of cost
  • I am a freelancer so interested customer can contact me for apart from this development also

Saturday, July 20, 2013

ERD (Entity relationship diagrams) for dynamics ax tables


     Yesterday I read the news from Microsoft dynamics ax community forum that Microsoft has published ER diagrams for some dynamics ax tables. so I just want to share with you guys. It includes 30 database ERDs for tables in dynamics ax. Its very helpful for developer like us to finding the relations between tables when we are trying to customize. here I given the link go and enjoy

ERDs-  http://go.microsoft.com/fwlink/p/?linkid=296623

Microsoft dynamics ax interview questions part 3 - Senior technical consultant

         
           Before I am joining Wipro InfoTech I had attend lot of interviews and I got offer from some finest companies. I feel proud to join in Wipro. so here I am going to post my third series of dynamics questions but its senior level. get on
 
  • Name the two dynamics framework newly added on Ax 2012
  • Explain ledger framework in AX 2012
  • In AX 2012 journal postings are running on IL code. So how do you debug the posting
  • What are all the steps in Dynamics ax 2012 upgradation. in which level you worked extensively explain it.
  • Name the two newly added best practices in Dynamics ax 2012 on all the AOT objects
  • Explain the table inheritance in AX 2012 with examples
  • Consider the situation that huge number of invoices happening on the particular company. so Client wants you to modify something on the invoice place. so what are all the steps would you take to prevent fall of performance in the system
  • Have you worked on SSRS.
  • When user wants to open the SSRS report I want some user input for the report. What are all the steps to get user input. (here I explained about the controller classes and dialogs to get user inputs)
  • Ok I need a lookup in that SSRS dialog field. how do you achieve it. what are all the classes you use.
  • Explain the types of way to get Data sources in SSRS report
  • Explain the data methods in SSRS report. what is the purpose when did you use it
  • Explain post handler and pre handler in AX 2012
  • how do you get the exchange rate for transaction currency (here I explained about exchangeratehelper class)
  • Explain trade agreements and their use
  • Explain model and model store
  • say some scripts you used at the time of data migration
  • How do you migrate the changes from Development to UAT
  • What is inbound and outbound
  • Explain the steps for creating services in dynamics ax
  • Explain the real time steps for development (Interviewer asking about the series of real-time development lifecycle in dynamics ax. This actually a tricky question here you have to explain the document preparation and step by step development process from Requirment to TDD)

 
 
 

Monday, July 15, 2013

Customer/Vendor Address import in dynamics AX 2012 through X++

15-07-13
Customer and Address import in Dynamics AX 2012 using X++
Problem: I was assigned to a task that import customer and their addresses from Excel sheet. I can import customer through code by using AXCustTable service class but what about addresses. In AX 2012 addresses changed a lot they created new framework for addresses.
Solved: I had gone through lot of websites for customer address import. Every code was almost identical. I am happy with all the codes but one thing the code doesn’t solve it. They all work until you have to fill all the address masters before create new address for customer. In my case I have to create new address not selecting the address for my customer. So I had gone through address framework and created the code for creating addresses as well as customers. So I had liked to share with you.  (But here I covered only the address part electronic address included)
 
Main method creating for address:
    DirPartyRecId                                                partyRecId;
    DirPartyPostalAddressView                          addressView;
    AxLogisticsAddressCountryRegion              axCountryRegion;
    AxLogisticsAddressCounty                           axCounty;
    AxLogisticsAddressState                               axState;
    AxLogisticsAddressZipCode                         axZipcode;
    AxLogisticsAddresssCity                               axCity;
    DirParty                                                          DirParty;
    DirPartyContactInfoView                              contactView;
    LogisticsLocationRecId                                 locationRecid;
    ;
    try
    {
            addressView.CountryRegionId = _CountryRegionId;
            addressView.State   = _state;
            addressView.City    = _city  ;
            addressView.ZipCode = _zipCode;
            addressView.Street  = _street;
            addressView.Party   = _custTable.Party;
            //addressView.Location    =   locationRecid;
                //Separate method find it in below code
            this.processAddress(addressView,_custTable);
            DirParty = DirParty::constructFromPartyRecId(addressView.Party);
                //Creating new address using dir party class
            if( addressView.Street || addressView.ZipCode || addressView.City || addressView.State ||                       addressView.CountryRegionId)
            {
                DirParty.createOrUpdatePostalAddress(addressView,_roleId);
            }
                //Electronic address creaiton
            if(_AccountManagerEmail!='')
            {
                contactView.LocationName = "Delivery email";
                contactView.Locator      = _AccountManagerEmail;
                contactView.Type         = LogisticsElectronicAddressMethodType::Email;
                contactView.Party        = _custTable.Party;
                contactView.IsPrimary    = NoYes::Yes;
                DirParty = DirParty::constructFromPartyRecId(contactView.Party);
                dirParty.createOrUpdateContactInfo(contactView);
            }
            if(_phone!='')
            {
                contactView.LocationName = "Phone";
                contactView.Locator      = _phone;
                contactView.Type         = LogisticsElectronicAddressMethodType::Phone;
                contactView.Party        = _custTable.Party;
                contactView.IsPrimary    = NoYes::Yes;
                dirParty.createOrUpdateContactInfo(contactView);
            }
            if(_teleFax!='')
            {
                contactView.LocationName = "Tele Fax";
                contactView.Locator      = _teleFax;
                contactView.Type         = LogisticsElectronicAddressMethodType::Telex;
                contactView.Party        = _custTable.Party;
                contactView.IsPrimary    = NoYes::Yes;
                dirParty.createOrUpdateContactInfo(contactView);
            }
            if(_url!='')
            {
                contactView.LocationName = "URL";
                contactView.Locator      = _url;
                contactView.Type         = LogisticsElectronicAddressMethodType::URL;
                contactView.Party        = _custTable.Party;
                contactView.IsPrimary    = NoYes::Yes;
                dirParty.createOrUpdateContactInfo(contactView);
            }
    }
    catch (Exception::Error)
    {
        info ("Customers not created");
    }
 
  Process address method:
    AxLogisticsAddressCountryRegion axCountryRegion;
    AxLogisticsAddressCounty        axCounty;
    AxLogisticsAddressState         axState;
    AxLogisticsAddressZipCode       axZipcode;
    AxLogisticsAddresssCity         axCity;
    LogisticsAddresssCity            addressCity; 
    ; 
    if(addressView.CountryRegionId  &&  !LogisticsAddressCountryRegion::exist       (addressView.CountryRegionId))
    {
        axCountryRegion =   new AxLogisticsAddressCountryRegion();
        axCountryRegion.parmCountryRegionId(addressView.CountryRegionId);
        axCountryRegion.parmCurrencyCode(_custTable.Currency);
        axCountryRegion.parmAddrFormat("0014");
        axCountryRegion.save();
    }
    if (addressView.State && !LogisticsAddressState::exist(addressView.CountryRegionId, addressView.State))
    {
        axState =   new AxLogisticsAddressState();
        axState.parmCountryRegionId(addressview.CountryRegionId);
        axState.parmStateId(addressView.State);
        axState.parmName(addressView.State);
        axstate.save();
    }
    if (addressView.County && !LogisticsAddressCounty::exist(addressView.CountryRegionId, addressView.State, addressView.County))
    {
        axCounty    =   new AxLogisticsAddressCounty();
        axCounty.parmCountryRegionId(addressview.CountryRegionId);
        axCounty.parmStateId(addressview.State);
        axCounty.parmCountyId(addressView.County);
        axCounty.parmName(addressview.County);
        axCounty.save();
    }
    if(AddressView.City &&  !Logisticsaddressscity::exist(Logisticsaddressscity::find(addressView.city).RecId))
    {
        /*axcity  =   new AxLogisticsAddresssCity();
        axCity.parmCountryRegionId(addressview.CountryRegionId);
        axCity.parmCountyId(addressview.County);
        axCity.parmName(addressView.City);
        axCity.parmStateId(addressview.State);
        axCity.save();*/
        addressCity.CountryRegionId =   addressView.CountryRegionId;
        addressCity.Name    =   addressView.City;
        addressCity.StateId =   addressView.State;
        addressCity.doInsert();
    }
    if (addressView.ZipCode &&  !LogisticsAddressZipCode::exist(addressView.ZipCode))
    {
        axZipcode   =   new AxLogisticsAddressZipCode();
        axZipcode.parmCity(addressview.City);
        axZipcode.parmCityRecId(Logisticsaddressscity::find(addressView.city).RecId);
        axZipcode.parmCountryRegionId(addressview.CountryRegionId);
        axZipcode.parmCounty(addressView.County);
        axZipcode.parmState(addressView.State);
        axZipcode.parmStreetName(addressView.Street);
        axZipcode.parmZipCode(addressView.ZipCode);
        axZipcode.save();
    }

Tuesday, June 18, 2013

Dynamics AX Interview Question Part 2 - scenario based

One of my friend attend a interview for an Europe client.. so i just want to share the questions he faced.

Client: Code optimization, There is one class in Ax. If the client wants to reduce the execution time of that operation. Its a custom class. so what are all your steps to optimize the class and reduce the time of execution

My Friend:
  • Use trace and code pro filer to find out the process that take much time and optimize it
  • Use indexes, joins and Queries in code.
Client: If there any clean ups available in AX to delete tables

My Friend : Yes, Sales and Purch parm table cleanups are available under AP/AR -> periodic
-> clean up. Then we can clear database log with the help of batch job. In  production its not advisable to enable the database log.

Client : Difference between For loop and While loop

My Friend: In for loop we can control the loop execution with the help of incremental operator.

Wednesday, January 2, 2013

Dynamics AX 2012: Import Inventory Journal Lines through code


01-02-2012

Import Inventory Journal Lines Through code in Dynamics AX 2012

Problem: My task was to import the journal lines in dynamics AX 2012 through code.

Solved:     There are two ways to import the code office add-ins and X++ code. Here I am going to explain importing journal lines through code. Because there are lot of blogs explaining the office –add in method. This code was given by my colleague Mahendran.

In below you can find the code used to import the journal lines. Here I missed out something; I hope you people can manage those things. Like,
·         X++ code to read data from excel
·         Proper class declarations and variable declarations
I am just going to give the heart of the solution. If you can’t make it up to this please feel free to mail me at hapkarm@outlook.com

    //Getting the essential values from Excel
    itemId                               = cells.item(row, 1).value().bStr();
    inventSiteId                       = cells.item(row, 2).value().bStr();
    inventLocationId               = cells.item(row, 3).value().bStr();
    inventBatchId                    = cells.item(row, 4).value().bStr();
    qty                                    = cells.item(row, 5).value().double();
    costPrice                           = cells.item(row, 6).value().double();
    mainAcc                            = cells.item(row, 7).value().bStr();
    department                        = cells.item(row, 8).value().bStr();
   
    locInventDim.inventBatchId                   = inventBatchId;
    locInventDim.InventSiteId                       = inventSiteId;
    locInventDim.InventLocationId             = inventLocationId;
    journalTrans.clear();
    journalTrans.initFromInventJournalTable(journalTable);
    journalTrans.TransDate                             = systemDateGet();
    journalTrans.ItemId                                    = itemId;

    //Finding out the invent dim id from given value
    journalTrans.InventDimId                        = InventDim::findOrCreate(locInventDim).inventDimId;
    journalTrans.PriceUnit                               = 1;
    journalTrans.Qty                                          = qty;
    journalTrans.CostPrice                              = costPrice;
    journalTrans.CostAmount                        = journalTrans.Qty * journalTrans.CostPrice;
    //Except these below two lines above things are same as like in dynamics AX 2009
    //If you want to insert the dimension value with account
    //In below code I have no dimension with main account so I just put 0, Instead I have two        
    //dimension
    //write a code like “[“MainAccount”, mainAcc, 2, Dinemsion1, dimVal1, Dimension2, dimVal2)
    offsetEntryPattern                                      = ["MainAccount",mainAcc,0];
    journalTrans.LedgerDimension              = AxdDimensionUtil::getLedgerAccountId(offsetEntryPattern);
    //Default dimension Value either you can insert the dimension value here.
    defaultDim                                                     = [1,"Department",department];
    journalTrans.DefaultDimension             =        AxdDimensionUtil::getDimensionAttributeValueSetId(defaultDim);
    journalTrans.insert();

If you need any assistance from above code feel free to put a mail on hapkarm@outlook.com