Tuesday, March 27, 2012

Data Import Export usinf Excel template

Dynamics AX 2009 – Import Customer master,Vendor master and their Primary addresses

The following illustration is for vendors. Similarly we can do for customers . Wherever needed I have mentioned what change would be required.To import vendors & customers in Microsoft Dynamics AX 2009, follow these steps:
1. In the Navigation Pane, click Administration>Periodic> Data export/import>Excel spreadsheets> Template Wizard.
2. In the Excel Template Wizard, follow the instructions to create a template for “VendTable”.  For customers the CustTable should be selected in the table selection step in the wizard.
When creating the template select the option to create a definition group in AX for this template.

Also select the ‘Create supporting table worksheet’. This will create the lookup values for selection in the template worksheet .

3. Ensure that the number sequence is setup for the address book Id in parameter for Global address book. Navigate to Basic>Setup>Global Address Book>Parameters.
Click the Number sequences tab, and then verify that a number sequence is selected for the address book ID.
Note The number sequence that is selected cannot be set up as continuous.
4. Prepare the data in the file that you created in step 2 with the data that you want to import. Ensure that the all mandatory fields are populated in correct format and there are valid values in the lookup fields.
5. Leave the Address book ID field empty. The Address book ID field is populated when you import the Excel spreadsheet by using the number sequence that you set up in step 3. Pls ensure that the Address book type is set to “organisation” in the data template as shown below.

6. Navigate to Administration>Periodic>Data export/import>Definition groups.
7. Select the definition group that you created by using the Excel Template Wizard, and then click Table setup.
8. In the Table setup dialog box, click the Import Criteria tab, and then add the following code in the Import Criteria tab after the default line in the window.
What we are doing here is that we are bypassing the code of importing the data through the standard AX’s data import code but would call the “Insert” method to read the file and do the import.
In the default line ‘vendTable’ object was declared for the table ‘VendTable’. Therefore, ensure that the correct object name is used in the code as well.
To import vendors, add the following code in the table setup’s Import criteria code.
;
vendTable.insert();// Insert method called to import the data
return false; // Bypass the standard AX data import code. Otherwise, the system will attempt to import the data twice and found that the record already exists.

For customers :
;
custTable.insert(); // Insert method called to import the data
return false; // Bypass the standard AX data import code. Otherwise, the system will attempt to import the data twice and found that the record already exists.

9. Click the Compile button.

This step determines whether the code is typed correctly.
10. Click the Preview tab, verify that the fields match the correct values that are entered in the Excel spreadsheet. Close the Table setup dialog box.

11. In the Data export/import dialog box, select the definition group that you created, and then click Import.

12. In the Excel import dialog box, If the Excel spreadsheet is not at the same path which is in ‘Default file name” column in the definition group then browse and select the Excel spreadsheet, and then click OK.

If its the same file at the path mentioned in the “default file location” then no need to select it again. System will pick it . Go ahead and press OK without selecting any file.
13. When the system finishes the importing the records you will get the following infolog :
OOOOOOPs

But don’t worry .. this infolog is for the Standard AX data import code . Since we have bypassed the code , we get this infolog. ( I do not want consultants here to bother the Techies for changing this /suppressing the infolog etc. They would feel too pricey. If we understand the concept then that is sufficient.
14. Verify that your Vendor is imported into the VendTable (vendor master) and the visible in Vendor form and that a corresponding record is created in the DirPartyTable table.


Good job so far .. smile
Check the address tab if it is created for the vendor.

The Vendor Address Type is blank and the Name has “Primary Address”. Therefore, a little fix is needed after the data is imported in the vendor / customer. We would need to run the following jobs. Copy them in AOT as jobs
15. Job 1 – Update the Vendor Address Type
static void J1A_UpdateVendAddressType(Args _args)
{
VendTable vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable dirPartyTab;
Address addTab;
;
ttsbegin;
while select vendTab
join dirPartyTab
join forupdate addTab
where vendTab.PartyId == dirPartyTab.PartyId &&
addTab.AddrTableId == dirPartyTab.TableId &&
addTab.AddrRecId == dirPartyTab.RecId //&& //Uncomment ‘&&’ if you wish to run for a single vendor else this would run for all vendors
// vendTab.AccountNum == ‘Shekhar’ //Uncomment this line to run for vendor ‘Shekhar’ only else this runs for all vendors
{
if(addTab.Name == ‘Primary address’) //Hardcoded , pls make sure the field is exactly same typed
{
addTab.type = AddressType::Payment; // If the job is being used for CustTable comment this line.
// addTab.type = AddressType::Invoice; // If the job is being used for CustTable uncomment this line.
addTab.update();
}
}
ttscommit;
}
Verify the fix in the vendor master’ address tab. : Good job ..smile

16. Job 2 – To update the Address Type for vendors.
static void J2A_UpdateVendAddressName(Args _args)
{
VendTable vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable dirPartyTab;
Address addTab;
;
ttsbegin;
while select vendTab
join dirPartyTab
join forupdate addTab
where vendTab.PartyId == dirPartyTab.PartyId &&
addTab.AddrTableId == dirPartyTab.TableId &&
addTab.AddrRecId == dirPartyTab.RecId //&& //Uncomment ‘&&’ if you wish to run for a single vendor else this would run for all vendors
// vendTab.AccountNum == ‘Shekhar’ //Uncomment this line to run for vendor ‘Shekhar’ only else this runs for all vendors
{
if(addTab.Name == ‘Primary address’ && addTab.type == AddressType::Payment) //Hardcoded , pls make sure the field is exactly same typed
{
addTab.Name = dirPartyTab.Name;
addTab.update();
}
}
ttscommit;
}
Verify the fix in the vendor master ; Done … Good Job again.

Now you have the vendor and customer master with the a primary address  .. Proceed to the next hurdle in data migration.
Additional Addresses : I would update in my Next post how to update the Multiple addresses without much of the coding .
17. Note :  I could find a very useful piece of information published by Microsoft on the subject and available at the following link. All consultants should have a look at this.
https://mbs.microsoft.com/knowledgebase/kbdisplay.aspx?wtntzsmnwukntmmyszrrnottukoostllwskmmqvylslnwrus&wa=wsignin1.0
I hope that the above helps all AX consultants.

Friday, February 24, 2012

EP and Roll Center Installation AX 2009

Installation steps for Enterprise Portal and Roll center in Microsoft Dynamics AX 2009.

  1. Install the prerequisite for the EP installation
  2. Run the setup and select EP and Roll center at first stage
  3. Click Next, if any prerequisite yet to be install it will sugget u and select the path of the sharepoint exe to install and configure it at the same time of installation.
  4. In the next stage it will show u the default web site for selection and to check box for configure and create a new website. Select Default Web site from drop down list and chek both the checkbox.
  5. Install the EP and Roll center.
This will show you the successfully complition of the setup. For further configuration follow the steps as given below.
  1. Go to the inetmgr (From Run) and check for new website has been created or not.
  2. if u have workflow on the same server then u have to first create new website with the same configuration of default web site and after installation u have to change the port number of new created web site to another.(You can change the port number from "Binding" option at the right side in inetmgr).
  3. Now Reset IIS.
  4. To check the successful installation of Ep and RC --> go to Sharepoint Central administrator from inetmgr then browse the it and select the tab Application Management. Then select site collection list and then copy the URL and check from browser.
  5. Run The Sharepoint Product and Technologies from Administrative tools (Control panel). No need to change any setting ..just nexrt....
  6. Run Configuration wizard form ERP Administration and check for websites.
  7. Add users to EP if needed.

Analysis Extension Installation in Ax 2009 Troubleshooting

While Installing the Microsoft Dynamics Ax 2009 Analysis Extension the following error has been raised which is resolved with the following solution.

ssas-ax-02
After applying the KB article SSAS Extensions still will not install.  Further research seems to indicate that the problem might be with some 9.0 SSAS assemblies in the GAC.
Setup does not recognize that SQL Server 2008 Analysis Services is
installed If you have SQL Server 2008 Analysis Services installed and you are
installing the analysis extensions, you might receive an error that says you
must install SQL Server 2005 Analysis Services with Service Pack 2. This
error message indicates that there is an Analysis Services 2005 version of
the Microsoft.AnalysisServices.dll file in the Global Assembly Cache.
Microsoft Dynamics AX does not support running Analysis Services 2005 and
Analysis Services 2008 on the same computer. To resolve this issue, uninstall
the Microsoft.AnalysisServices.dll file that has a version number of 9.0 from
the Global Assembly Cache (typically located at C:\Windows\assembly).
Important: Be sure that you do not uninstall the
Microsoft.AnalysisServices.dll file that has a version number of 10.0
ssas-ax-01
I checked and sure enough there were.  So I looked and found SQL Server 2005 Express installed on the machine, not sure why.
Anyway, I uninstalled SQL Server 2005 Express and also the SQL Server 2005 Analysis Services ADOMD assemblies.
ssas-ax-03
I checked the GAC after uninstalling the 2005 components and I had a clean GAC, only 10.0 references.
ssas-ax-04
On to install again…and the Analysis Extensions can now be installed!

ssas-ax-05
Oh how beautiful it is:
ssas-ax-06

Friday, February 10, 2012

Bank Deposite, Payment has been cancelled

While Canceling Payment by system through Customer Transaction (Account Receivable>customer detail>Transactions>Cancel Payment)
Error accoured : "Payment xxxxxxxx has already been canceled"
Solution:
1. Open BankDeposite Table
2. Change MaxAccessMode property of table from View to EDIT
3.Find out the DepositeNum (which mention in Error)
4.Untick the field Cancelled
5.That's done. Now save the table and again change the MaxAccessMode to View

Thnx

Wednesday, February 8, 2012

AX 2009 Workflows: A Quick overview

Here is a quick overview on AX 2009 Workflow...a feature long awaited :)

Workflow - "Machine readible code for a business process"-Feature of Base AX 2009
-Workflow components reside on a Web Server
-Utilizes the Windows orkflow Foundation (.NET 3.0)
-Utilizes the AX Batch framework
-Requires AD User for Workflow
-Requires exclusive site on IIS to function
-The Workflow components on the Web server use the .NET BC to communicate with the AOS using Workflow system account(existing AX user).
Architecture overview:-


Setup (Steps):-
-Setup AD User for Workflow Account & configure in AX
-Setup & Configure IIS on Web Server
-Setup Workflow Component using AX installation option
-Run the Workflow Infrastructure Configuration Wizard {Batch Jobs, Workflow site}
-Configure the Workflow in AX
Workflow Objects:
Workflow templates:
Workflow templates capture information about workflow categories , what business document the workflow will operate over, what workflow elements (Tasks and Approvals) are required in the workflow configuration,which application event handlers will handle the events that are raised as the workflow executes etc.The first step in creating a workflow is to add a workflow Template. A Workflow Template can be said to be the metadata A workflow template provides information on:
• Which workflow document to use.
• Tasks and approvals that can be configured by the user.
• Workflow categories used for assigning a workflow template to a specific module.
Workflow category:
The workflow category determines whether a workflow template is available in a specific module. After a workflow
category is created, it is possible bind the workflow category to a workflow template.


Workflow Configuration:
A Workflow Configuration is bound to a single Workflow Template, and there can be multiple Workflow Configurations
for the same Workflow Template. Only a single Workflow Configuration for each WorkflowTemplate can be the default WorkflowConfiguration. The Workflow Configuration captures what tasks will be executed, who the tasks are assigned
to.
Workflow Query:
Dynamics AX workflow uses a query to set up conditions for a workflow. The query identifies which data is available to workflow users. Queries are bound to Workflow templates. Once the query is created, a Workflow class needs to be created which contains the query name & any calculated fields.
Workflow Tasks:
AX workflow tasks are used to track documents or tasks from the start to the end of a work process. A workflow may
contain one or many tasks. Each task contain one step.

Workflow Approvals:
Workflow Approvals are used to track ststus of Workflow documents . The fixed outcomes are ‘Approve’, ‘Reject’, or
‘Request Change’.

After you create a task, approval, or outcome in a AX workflow, it must be added to a menu item. The end-user can then start the task or approval using the menu item as a part of the workflow process.
Workflow can be activated throughout the various lifecycle stages of a business document: Create, Update, Delete, Post. The Workflow runtime will execute the Workflow and assign Tasks to users. Users interact with theWorkflow through Alerts/Workflow Tasks, from where they can take action (Approve, Reject) or they can navigate to the business document and view all details before taking the workflow action.
Apart from these basic concepts, there are concepts like Implement Providers, Event Handlers which I will explain in a later post.

Tuesday, February 7, 2012

HTTP Error 404.17 - Not Found

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Error in IIS 7.0

This Problem occures due to installation of .NET Framework 4.0 is available on your machine.
Solution:
You can back up your web.config and web content, then revert your site's mappings to parent's, it should work for you
IIS Manager->high-light you web site->click Handler Mappings icon on the home pane->click Revert to Inherited... on the right Actions pane.

Thnx