Monday, November 09, 2015

Limitations Of OData Service in AX 2012

Dear Friends

Those who are familiar with OData may notice that the OData query service has a few limitations. It's important to know these and not make assumptions so that you don't run into any surprises. The limitations are as follows:

No JSON support: The OData protocol supports Atom as well as JSON, but Microsoft Dynamics AX 2012 only supports Atom.

No create, update, or delete: With OData, you can also modify data instead of only reading it, but this feature is not supported in Microsoft Dynamics AX 2012.

No support for query options: OData supports query options that allow you to, for example, select only the top five records, select only a specific entry, or sort the feed; however, this feature is not supported in Microsoft Dynamics AX 2012 and using it will result in an error.

No support for queries with fetch mode 1:n: Using a query that has a data source which has its fetch mode set to 1:n will result in an error in the event log for the Feature Pack release and a warning for the R2 release. The latter will automatically convert the 1:n fetch mode to 1:1, which is the only fetch
mode that is supported.

No support for views: Queries that use views are not supported, and using a view will result in an error.

Happy DAXing.... :)

Tuesday, September 08, 2015

How to implement basic authentication with AIF services in Dynamics AX 2012

Disclaimer:  This sample is not a production ready solution.  As described below the user credentials will be passed in plain text which is not ideal in a production environment.  To prevent this from occurring it would be recommended to incorporate SSL with this solution.

1.     Create inbound HTTP port.
a.     Navigate to System administration->Setup->Services and Application Integration Framework->Inbound ports.
b.     Create an inbound port using the HTTP adapter with settings similar to the image below.
Basic settings:


Service operations:

1.     Activate the new inbound port.
2.     We need to configure the client configuration.  In order to do this you need to select the ‘Configure’ button. Note:  Do not select the ‘Configure AOS’ button.
3.     You should see a dialog with a warning.  Just click yes to continue loading the configuration file.
4.     Locate the Bindings section under the Configuration frame and select ‘New Binding Configuration’ from the Bindings frame.
5.     Select ‘basicHttpBinding’ and click OK.
6.     In the ‘Name’ field enter ‘basicHttpBindingWithBasicAuth’.


1.     Click the ‘Security’ tab and set the attributes as shown below.


1.     Locate the ‘reqReplyEndpoint’ in the Configuration frame, and highlight it.
2.     Change the BindingConfiguration attribute for the endpoint from ‘basicHttpBindingWithWindowsAuth’ to ‘basicHttpBindingWithBasicAuth’.



1.     Save the configuration file and close the WCF configuration editor.
2.     Activate the SalesOrderHTTPService port.
3.     Open IIS manager and navigate to the MicrosoftDynamicsAXAif60 virtual directory.  Highlight it, and from the main frame open ‘Authentication’ from the IIS group.
4.     Enable Basic Authentication.  Your settings should look like that below.


1.     Close IIS manager and complete an iisreset from a command prompt.
2.     Open Visual Studio.
3.     Select File->New->Project.  From the New Project dialog select Windows Forms Application.  Enter a name for the project (e.g. SalesOrderTest).  Click OK.


1.     Once the project opens drag a button from the toolbox onto the form.


1.     Add the Sales Order Service reference to the project.  Note:  You can pull the address from the ‘Inbound ports’ form within Dynamics Ax. 
Important:  You will be asked for credentials in order to access the service and metadata.  I entered my administrator account and password until the RoutingService showed in the Services frame below, then cancelled all remaining authentication dialogs.  This will only work if you have Windows and Basic authentication enabled on your IIS box for the AIF virtual directory.



1.     Close IIS manager.  Open a command prompt and complete an iisreset.
2.     Open Visual Studio and open your project back up.
3.     Double-click the Button on the form to open the code window and create a new button_click event.
4.     Add a ‘using’ statement for the sales order web service. 

1.     Within the newly created button click event paste the following code.
            SalesOrderServiceClient proxy = new SalesOrderServiceClient();
            proxy.ChannelFactory.Credentials.UserName.UserName = @"domain\user";
            proxy.ChannelFactory.Credentials.UserName.Password = @"password";

            CallContext context = new CallContext();
            context.Company = "ceu";

            AxdSalesOrder salesOrder = new AxdSalesOrder();
            AxdEntity_SalesTable[] salesTables = new AxdEntity_SalesTable[1];
            AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
  
            salesTable.CurrencyCode = "USD";
            salesTable.CustAccount = "1103";
            salesTable.ReceiptDateRequested = Convert.ToDateTime("2/1/2012");
            salesTable.Payment = "N060";
            salesTable.PurchOrderFormNum = "PO113";


            #region Financial Dimensions
  
            AxdType_DimensionAttributeValue dimBusinessUnit = new AxdType_DimensionAttributeValue();
            dimBusinessUnit.Name = "BusinessUnit";
            dimBusinessUnit.Value = "20";


            AxdType_DimensionAttributeValue dimCustomerGroup = new AxdType_DimensionAttributeValue();
            dimCustomerGroup.Name = "CustomerGroup";
            dimCustomerGroup.Value = "10";


            AxdType_DimensionAttributeValue dimDepartment = new AxdType_DimensionAttributeValue();
            dimDepartment.Name = "Department";
            dimDepartment.Value = "500";
  
            AxdType_DimensionAttributeValueSet valueSet = new AxdType_DimensionAttributeValueSet();
             valueSet.Values = new AxdType_DimensionAttributeValue[3] { dimBusinessUnit, dimCustomerGroup, dimDepartment };
            salesTable.DefaultDimension = valueSet;
             #endregion
  
            AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
             salesLine.ItemId = "1000";
            salesLine.SalesQty = 1;
            salesLine.SalesUnit = "ea";


            AxdEntity_SalesLine salesLine2 = new AxdEntity_SalesLine();
             salesLine2.ItemId = "1000";
            salesLine2.SalesQty = 55;
            salesLine2.SalesUnit = "ea";

             AxdEntity_SalesLine salesLine3 = new AxdEntity_SalesLine();
            salesLine3.ItemId = "10004";
            salesLine3.SalesQty = 21;
            salesLine3.SalesUnit = "Pcs";
  
            AxdEntity_InventDim inventDim = new AxdEntity_InventDim();
            inventDim.InventSiteId = "1";
            salesLine3.InventDim = new AxdEntity_InventDim[1] { inventDim };

             salesTable.SalesLine = new AxdEntity_SalesLine[3] { salesLine, salesLine2, salesLine3 };
            salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable };

             try
            {
                 proxy.create(context, salesOrder);
                MessageBox.Show("Worked");
            }
  
            catch (Exception ex)
            {
                 throw ex;
            }

1.     Open IIS manager and navigate to the MicrosoftDynamicsAXAif60 virtual directory.  Highlight it, and from the main frame open ‘Authentication’ from the IIS group.
2.     Disable Windows Authentication.  Your settings should look like that below.


1.     Close IIS manager and complete an iisreset from a command prompt.
2.     Build and test the program.
Note:  The data presented in the sample above may not coincide with your existing database.  You may have to update the code to validate against your AX setup.  If you do not update the sample code you are likely to get a validation error returned from the server.

Happy DAXing.. :)

Source : MSDN Blog

Monday, August 10, 2015

Integration Technologies for Dynamics AX 2012

As enterprises move towards using more and more specialized applications rather than having ERP do everything for them, you need a robust framework & strategy for managing integrations within the ERP system. Dynamics AX provides many such robust frameworks and functionalities to integrate with third party applications using modern techniques

The following section outlines the commonly used integration technologies in Dynamics AX.  It is important to make sure the technical analysts and developers on your project are familiar with these technologies so that they can support the design process and identify the best integration solution for your project

The following table compares integration technologies to help you determine the suitable integration tool as per your requirement.
Pros
Cons
Good for 
Examples 
AIF 
·       Robust framework
·       Out of the box  services
·       Administration and monitoring
·       Scalable
·       Secure

Framework overhead
·       Document based exchanges
·       Transaction processing across system
 Create/update Sales orders
Create customers
Send Product details
Send Price details
Send AP payment data
DIXF
Robust framework
Future async integration methodology for dynamics AX
Need extension to automate and administer the process

High volume integrations
Master data synchronization
GL Integration
Expense report import
Master data sync
.NET Framework
Utilize power of .NET programing languages

Add on solutions
Integration with .NET apps
Transformation components
Integrating with specialized SDK such as OCR*
Business Connector
Expose dynamics AX business logic
Utilize AX security framework
Phasing out
Uses TCP communication protocol
Application extension
Application for handheld devices
Third party Integration Solution
Specialized end to end solution
Special scenario only
Specialized third party applications
Sales tax
AP automation
EDI Integration
Banking
Credit Card


Happy DAxing.... :)

Friday, July 24, 2015

How to Modify Tools Menu?



Hello Friends,

Today, I will demonstrate how system menus can be modified. I will add a link to the Online users form in the DevelopmentTools menu.

Please carry out the following steps in order to complete this recipe:

1.      In the AOT, locate the DevelopmentTools menu.
2.      Add a new separator to the top of the menu.
3.      Add a new menu item to the top of the same menu, with the following properties:
Property
Value
MenuItemType
Display
MenuItemName
SysUsersOnline

4.      The DevelopmentTools menu should look as in the following screenshot:


5.      To test the menu, restart the client, and note the newly added Online users option under the Tools menu in the Development workspace window:




Happy DAXing…. J

Enable UAT database over OneBox DevTest environment using JIT

 Dear Friends, In this Article I will show you how to enable UAT database access for Development machine using just-in-time (JIT). Many time...