Archive
March, 2010
Browsing all articles from March, 2010
2

I had a case where I tried to call a Dynamics AX 2009 AIF Web service from an XML Web Service (.asmx). But the new thing in this case is that the AIF Web Service call is actually inside a dll referenced in this new asmx web service.
When you reference that dll into a web service/asp.net project in the Visual Studio .NET, and then call the function inside that dll which calls the Dynamics AX AIF Web Service… you will have the following error:

System.InvalidOperationException: Could not find default endpoint element that references contract 'AXGLServiceRef.GeneralJournalService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase`1..ctor()
at AXWCFClassLibrary.AXGLServiceRef.GeneralJournalServiceClient..ctor()
at AXWCFClassLibrary.Class1.checkme() at Service.HelloWorld(String name, String accval) in d:WebSite1App_CodeService.cs:line 21

This error is actually due to that the end point that this dll is trying to reach is unidentified to this web application. What you have to do is:

  1. Go to the class library project where you created that dll
  2. Go to app.config
  3. Copy the whole ServiceModel part
  4. Go to the web.config in your new web application
  5. Paste the ServiceModel part inside the Configuration part

By this, you will be able to execute without getting that endpoint error

0

What is LedgerJournalFormTrans Class?

If you ever tried to modify the LedgerJournalTransDaily form (the Ledger Jourlan Lines form) you would notice a forest of X++ codes executed on every click, initializations, closing, fields modifications… etc. Of course this makes sense because this form is basically the backbone of financial transaction of this Dynamics AX, which in turn the backbone of all modules of Dynamics AX.

One of the common classes executed in this form is LedgerJournalFormTrans class. Basically this class controls the controls of any form where LedgerJournalTrans table is a datasource for that form. It simply controls the visibility, edibility and validity of most of the controls on that form based on the “status” of the current Ledger Journal Trans and Ledger Journal Table. Whenever a user fills data, reads data, and clicks buttons and menu buttons.. a call for a method in that class is executed to control the new write/read/event.

Actually LedgerJournalFormTrans is an important class of a series of extended classes. Those classes are like the following:

  • JournalForm --> JournalFormTrans --> LedgerJournalFormTrans --> LedgerJournalFormTrans_Payment
  • JournalForm --> JournalFormTable --> LedgerJournalFormTable 

I believe from the name you could tell what all of those classes are all about.

0

I personally believe that implementing an ERP successfully, is nothing but a huge change in organizations. This change involves processes change, organizations structure, new challenges, eliminating old challenges, quicker response to clients, better and quicker planning.. etc. These changes are only part of the changes that this ERP software does. It’s not like any other type of software like content management or portals for example.

If you are an implementer for ERP or an end user in an organization that is experiencing an ERP implementation… you have to put this idea before, during and after the implementation. You have to have this idea in order to think how the user thinks, to encourage people around, to let them involved in this change, to support you to achieve the goals of the change in its optimal goals.

According to statistics, the main reason behind EPR failure is not the software implemented… rather it is people. 80% of ERP failure reasons are people! Nature of people in the whole world refuses changes. Even if this change is for their own good, they just refuse it… because it is a change.

A very good example of the support that all people involved in the implementation should have is what I have seen when I was visiting a company in Riyadh. This company is currently implementing SAP, they have put a screen in front of the main gate of the company showing a counter for the remaining days, hours, minutes and even seconds for the go live date. Here is a picture for it:

 

This kind of encouragement is very vital for people to feel the responsibility on their shoulders every time they go into the office.

3

A question might come to your mind, what’s the difference between a Dynamics AX 2009 Workflow Task and a Workflow Approval in AOT. They both are having almost the same properties and you could attach them to a workflow template.

Workflow in AOT

The workflow in Microsoft Dynamics AX 2009 is managed in a way that enables the workflow designer (who does the workflow configuration, a functional consultant in most of the cases) divides one “stage” approval into multi steps.

For example, if a Leave Request needs to be approved by the HR department, then the case might be in a way that approval must be processed by an HR Assistant and NOT the HR Manager in case that the leave does not exceed three days. But if the Leave Request is for more than three days… the HR manager must approve it also.

To enable this scenario, the workflow should be fixable so that the workflow designer is able to add as many steps per one approval “stage” as he likes. This is done by adding a Workflow Approval to the Workflow Template. When you go and configure this workflow template in the Workflow Configuration, you will be able to add as many steps as you wish… and you could also configure each step by specifying who this step will be assigned to and in what condition. And the workflow approval stage will not be completed unless all the steps are completed.

Now for the Workflow Task, this cannot be done. A Workflow Task represents only ONE STEP of a Workflow Approval. The workflow designer cannot add steps to this Task; he only could assign a person and a condition for this step/task. Task is nothing but a single unit of work.

The following image describes what I said:

Task and Approval in Dynamics AX 2009 Workflow

Another differnce is that a a task does not have a fixed outcome. However, you can add any number of custom outcomes to the task, such as Completed or Skipped.

3

I faced a very strange error two times so far saying that there is date2StrUsr function:

“The wrong number of arguments has been specified for the function”

and on the base enum DateFlags:

“The enumeration does not exist on DateFlags base enum”.

 Actually this has happened due to some “crash” in the SP1 of Microsoft Dynamics AX 2009. DateFlags and date2StrUsr with the new arguments have been added to SP1 of Dynamics AX 2009.

 I still do not know what the cause of this error is. The two times I have faced this problem were on two different clients where those clients were in the system configuration phase and some data were imported already. So before this error came up, there were using the system with the SP1 installed just perfectly.

Anyway, in order to solve the problem.. you simply have to uninstall the AOS only.. restart your server, re-install it again with the same name you were specifying as an AOS name.

I’m listing here the steps of how you do that in a safe manner. You might not go through them, but if you’re system is up and running and contains data that you don’t want to lose.. do the following:

  1. Stop the AOS service
  2. Backup your DB in case you something went wrong (you never know)
  3. Install a new another AOS instance, DB and Application Files for testing purposes (you don’t need to start the service here)
  4. Install SP1 on the new AOS and Application Files
  5. Run the service
  6. Open your Dynamics AX client on the new AOS configuration. Go with check-list steps.. most importantly: Compile and Database Synchronization (no need to import any data)
  7. After you’re done of the check list, go to AOT and try to compile: CurrencyExchHelper.. class. Insure that it complies with no errors. (This class uses DateFlags and date2StrUsr of SP1). If you see the same errors on this new AOS instance, then your SP1 installation went wrong. Re-install it again. You might also insure that you are using good installation files by downloading them again from PartnerSource.
  8. After insuring the the SP1 installation went just right, you might need to move also the customization you were doing on the old instance. So stop the service, get the customized layer like axVAR.aod for example and paste it in the new application folder.
  9. Run the service again, and compile the whole application by going to: Administrationà Periodic à Compile application
  10. Now, you need to re-install the AOS service in the same name, by:
    1. Uninstall the AOS from Programs and features on Windows 2008 or Add/Remove programs on Windows 2003
    2. Restart the machine (this is important)
    3. Install the AOS in the same name of the old service (do not run the service)
    4. Install SP1 for the new AOS
    5. Stop all services of Dynamics AX 2009
    6. Start the Microsoft Dynamics AX 2009 Server Configuration Utility and change the application Instance of the old AOS to the new application folder. Also do the same for the database (point to the new database).
    7. Run the Old Service.
    8. Open Dynamics AX client on the old configuration and go to the CurrencyExchHelper class. Compile it and insure that it shows no errors.  
    9. Stop the service. Go to the old application folder, delete the file: axapd.aoi
    10. Start the Microsoft Dynamics AX 2009 Server Configuration Utility. Point the new service (with same old name) to the old database and application folder.
    11. Run the service.
    12. Terarararaaaa it runs and no compilation errors again! It is recommended that you re-compile the application again.

 

 

1

If you ever called the AIF Sales Order Service in Dynamics AX 2009, then you had to specify the Customer Requisition (PurchOrderFormNum) field in SalesTable although this field is not really mandatory.

The Sales Order web service assumes that it is called from trading partners applications. Thus, whenever a sales order is created, this means that it has been created based on a request (Purchase Requisition most of the time) by this trading partner to your organization. And this requisition should be recorded in the PurchOrderFormNum field.

But why does the AIF Web Service create Journal type sales order then? The AxdSalesOrder class (the AX Document class) checks whether this sales order has been requested before by this customer (CustAccount field) or not. If it has been requested before, then this means that this customer (the one who sent this sales order document via the AIF Sales Order service) is purchasing based in the same Sales Order.. so Dynamics AX does not need to create another sales order, it creates Journal type sales order instead for the same customer and the same Customer Repulsion.

A great detail of the Sales Order Document Service is found in this link: http://msdn.microsoft.com/en-us/library/cc967401.aspx.

You might face the same scenario that I’m facing with one of my customers currently, that is migrating sales orders from an internal legacy system where you want only to migrate sales orders without checking for a Customer Requisition. If this is what you’re looking for, then all what you have to do is to comment the code in AxdSalesOrder class and prepareSalesTable method:

select firstonly localSalesTable
where 	localSalesTable.CustAccount 		== _axSalesTable.parmCustAccount() &&
	localSalesTable.PurchOrderFormNum 	== _axSalesTable.parmPurchOrderFormNum() &&
	localSalesTable.SalesId           	!= _axSalesTable.parmSalesId();
 
/*COMMENT FROM HERE
if (localSalesTable)
{
	_axSalesTable.parmSalesType(SalesType::Journal);
}COMMENT TO HERE*/
0

When you call the out-of-the-box AIF Sales Order Web Service, you might face a very strange and non-understandable error message saying:

The request failed with the following error: The element ‘SalesTable’ in namespace’http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder’ has invalid child element ‘QuotationId’ in namespace’http://schemas.microsoft.com/dynamics/2008/01/documents/SalesOrder’.

If you faced this, and looked for a solution you might have gone to Dianne Siebold’s WebLog:http://blogs.msdn.com/dsiebold/archive/2010/01/21/request-failed-error-in-aif.aspx. Honestly, in the beginning I did not get what she said. Then when I got what she is trying to say, I did not like it :D, with all my respect to her of course.

Now when you dig in the XSD generated from the Sales Order Service, you would notice that the field Customer requisition (PurchOrderFormNum) is mandatory… you have to include it in your message. This is what this “unclear” message is all about.

But the question that might cross to your mind is why I should include such field in my Sales Order although I can create new sales order in the Dynamics AX Sales Order Details form with filling this field.

This is what I will explain in my next post :).

0

When I installed Dynamics AX AIF to a new server with these specs:

  • Windows 2008
  • IIS 7
  • .Net Business Connector

After installing those compoents + AIF Webservices (from the Dynamics AX 2009 media), you will not be able to view the .svc files in the IIS.

In order to vew the *.svc files and get the link in WSDL, you have to use the Service Model Registration toll in the .NET framework folder in windows. Follow these steps in order to have it viewed:

  1. Go to: Start> All programs> Microsoft Visual Studion 2008 (or 2005)> Visual Studio Tools> Visual Studio Command Prompt
  2. Write: cd <<<Windows installation path>>>windowsMicrosoft.NETFrameworkv3.0Windows Communication Foundation
  3. Write: ServiceModelReg.exe -i -x

If this completed successfully, you now are able to view/browse the svc (WCF services) in IIS 7.

0

My website is back!!!! :)

After spending nine sad days away of my lovely sweety website, blog any email due to domain expiration and silly excuses from the hosting company.

From today till three years you could find my blogging without facing any problems like amerax.net is not available!!

For those who visited my blog during the last nine days, please accept my deep apology and you’re welcome to come back again.

All my nice regards,,,

Amer Atiyah

Dynamics AX 2012 Event

Recent Posts

Tags

Archives

Random Testimonial

  • ~ Muzammil Ahmad, ERP Manager at Abdul Aziz Alsorayai Investment Group

    33a1e92"Thing that I have seen in Amer in a broader view, that, he is a type of guy who takes the tasks in a professional way,concentrate on tasks, work on them with a cool & calm mind but fullfil the tasks in time. Having a humble nature, its normally a pleasure for everyone to work with Amer"

  • Read more testimonials »