Wednesday, January 26, 2011

MS Dynamics AX - SharePoint - .NET: UTCDateTime to Date Conversion (Error Operand type...

MS Dynamics AX - SharePoint - .NET: UTCDateTime to Date Conversion (Error Operand type...: "The utcdatetime data type is intrinsic to X++. It combines date and timeOfDay types into one type. A utcdatetime variable also holds time zo..."

UTCDateTime to Date Conversion (Error Operand types are not compatible with the operator)

The utcdatetime data type is intrinsic to X++. It combines date and timeOfDay types into one type. A utcdatetime variable also holds time zone information, though this information is not accessible to X++ code.

I wanted to fill the SalesQuotationTable.QuotationDate (Custom field from older version - Type Date) field in all my quotes,

Tuesday, January 25, 2011

Super() ... When design gets in the way : (

The following is the definition from this web site

The super keyword is used in a derived class to access the same method on its base class.
void method2()
// Call method2 method
// on the base class.
I was having a problem when trying to write a new Quote into SalesQuotationTable this morning. For some reason every time I wanted to create a new quote (by clicking OK), a warning message would come up saying "The field Business Relation has to be filled".

Ok, no problem, the above told me that probably the last developer set the field to be mandatory or there should have been something in the code that was checking for this field to be filled.

The strange thing was that the field wasn't mandatory and depending from where the quote was coming, the field would not be needed. For example, if the Business Relation account was converted to a Customer, the business relation does not show in the SalesCreationQuotation Form. Instead we show the Customer Account and viceversa.

This is the code that decides that:

prospect          = (accountType.selection() == smmQuotationAccountType::BusRelAccount) ? true : false;
    if (prospect)
Now, with this information I started suspecting about my classes calling base classes methods that I was not aware of, and I took a close look to the Super calls.

So from the ValidateWrite() method in the SalesCreationQuote Form, the Super() would call the ValidateWrite() method in the SalesQuotationTable. Now, I discovered that the ValidateWrite() method in the SalesQuotationTable Super() call was always directed to a class to show an info log.

After reading this blog I decided to suppress the Super() call from the ValidateWrite() method in the SalesQuotationTable and I was able to write to the SalesQuotationTable with no problem.

I tested it with records being called from the Business Relation Form, or straight from the SalesQuotationDetails and choosing a new record manually.

: )

Table [] called without buffer

I was  working on AX 2009 CRM Module creating a new Lead. Everything worked fine but the Qualifying Process Drop Down List (and button).

Basically I was trying to develop a customization around the form, and I needed to understand the Stages process , but I was being unable to get that far as I couldn't select anything from the Qualifying Process (it was empty), and because of that reason both the Qualifying Process and Stages button were grayed out.

Anyway, I right clicked the Qualifying Process Drop Down List (on the Grid) and then went to "Go To Main Table" and I got an error saying "No object specified on menu item Hierarchy". Mhhhhhhhhhhh....

Then reading some blogs about the error I learned that I needed to create a new menu item named Hierarchy (The same as the Table/Form) pointing to the Hierarchy form. When I went back to the Qualifying Process Drop Down Menu again and clicked "Go To Main Table" I got the error "Called without valid buffer"

What does this error mean?

Well, based on Microsoft the error is caused due to the form requires that it be called from something else, and the other object will pass in a record. 

Response from Microsoft:
If you examin the init() method of the Hierarchy form, you will see the following code:

 if (isTemplate)
        projActivityLink = false;
        if (element.args().dataset() != tablenum(Hierarchy))
            // Called without active buffer
            throw error("@SYS18626");

Notice the if statement after the else.  This is testing to see if the record being passed in comes from the Hierarchy table.  If this fails, it throws the error. 
Since I created a menu item and did not pass in a table buffer from the Hierarchy table, this causes the error message to occur.

The problem is that I haven't resolved the problem yet as I decided to just keep working on other customization for now on. I will post the answer when I get it. Of course if you happen to know the answer, it would be great if you could share it with me.

Friday, January 21, 2011

DeliveryCountry Field in 3.0

The field from smmQuotationTable.DeliveryCountry (AX 3.5) was changed to:


More info here

LINQ Left Left Outer Join

I wrote an application for my company which required me to use data coming from an external application (Microsoft Dynamics AX). This is actually a view that is generated by a job every night.

The table contains all the branches information (Name, Address, Country, ID, ect).

Wednesday, January 19, 2011

internal size of the records in your joined SELECT statement is 25006 bytes... Problem and Resolution

While testing the AX 2009 CRM module today I clicked Update > Quotation button and I got the following error:

The total, internal size of the records in your joined SELECT statement is 25006 bytes, but Microsoft Dynamics is by default performance-tuned not to exceed 24576 bytes.

This means that the Max Buffer Size in the Dynamics AX Server Configuration Utility is either too small or blank. In my case was blank.

To Resolve the issue I opened the Ax Server Configuration Utility (Start > Administrative Tools > Microsoft Dynamics 2009 Server Configuration) and I created a new configuration pointing to the same AOS instance.

Under the tab named Database Tuning I set the filed named Maximum Buffer Size to 70570 and saved the configuration.

When I opened AX 2009 again and I replicated the action (explained above) everything worked fine.

Create a new Number Sequence for a Lead ID in AX 2009 CRM

I experienced something extrange today while setting up AX 2009 CRM module. My organization did several modifications in the prior version of AX (3.0).

While testing the lead functionality I noticed that the user has to come up with an ID (write an ID ... weird). So I thought it was because of the customizations made to the systems in prior versions, but then I realized that the 3.0 version did not have leads.

After doing some research, I realized that the way to do it is the following:

Go to CRM - Setup - Parameters - Number Sequence (Tab) >

Look for the Lead Id name under the Reference Column. In my case this was empty. So I went to:

Basic - Setup - Number Sequences - Number Sequences - and I created a new record like the:

Number Sequence Code: CRM_12 
Name: CRM Lead ID 
Smallest: 1
Largest: 999999 
Next: 1 
Format: L-######## 

Then I went back to CRM - Setup - Parameters - Number Sequence (Tab), and assigned the newly created number sequence to the Lead ID and done.

AX 2009 Address Global Book - : (

In Dynamics AX2009, the Global Address Book is a repository for every Person OR Organization that your organization comes into contact with. 

When you create a customer, vendor, employee, business relation, contact or competitor, a record is automatically created in the global address book.

However, only certain common fields are shared:

•    Name
•    Address
•    Communicaitions (Telephone, fax, etc)
•    Number of employees
•    Organization number
•    Category

Other data will not be synchronized.

SharePoint Query String URL Filter Web Part

I created an application using WSP in Visual Studio 2008. This application is template to record tasks that are assigned to different regional managers within our organization.

The CEO of the organization will go over these tasks every Monday and plan accordingly. So he needed to have a quick way to see all the tasks for all the locations at once. We decided to create a report using conventional reporting tools.

One of the challenges we faced was that we needed to pass a parameter to the report server, which is integrated within SharePoint. However, we still needed to create a SSRS Web Part, which would not take an URL query string. Additionally, the SSRS Web Part was created in a new site within the SharePoint organization site.

Anyway, I found the following article that helped me resolved this issue by implementing a Query String Web Part file into my environment. So, when the user clicks a button called "View Report", a parameter is sent through a Response.Redirect() from my application code behind language (C#) to the new Sharepoint Site where the SSRS web part is. The parameter is then capture by the Query String Web Part (This web part is on the same site and "page" that the SSRS web part is) and passed internally to the SSRS report server web part.

For more information on how to use the web part please go to the following link:

Tuesday, January 18, 2011

Microsoft Dynamics AX CRM - Business Relationships

While working in the migration from MS Dyanmics AX 3.0 to AX 2009, I noticed that in the CRM module the Business Relations has some new cool features:

  1. The contacts list is right below the business relations. In AX 3.0 one needed to go to a different screen.
  2. When creating a new prospect that is not link to neither a Customer or Vendor account, AX will automatically assign the employee ID related to the business relation from the DirPartyTable.
Also, what caught my attention was the fact that the Bussines Relation form has 13 more datasets that the 3.0 version as now there are common tables that share id's, such as the address and emplTable for example.

Installing SharePoint Foundation on Windows 7 X64

I just installed Sharepoint Foundation in Windows 7 X64. I had to follow this article ( very closely to get it to work. Specially when it comes to installing the hot fixes, one MUST do it. For example I have SQL Server 2008 R2 and I thought the SQL server hot fixes would not apply to my case. Wrong!.

Also, for some reason the installation of the Windows Identity Foundation went wrong the first time I did it without me knowing about it and the wizard did not run. So, I uninstalled the whole thing (Sharepoint Foundation installation), then I installed all the hot fixes for it and installed Sharepoint again.

The setup run with no errors and the configuration wizard run with no errors, so in my eyes it worked, but my site was blank. I went to the IIS and under Authentication for Sharepoint Central Administration and the Sharepoint sites, I changed the Basic Authentication from Disabled to Enabled.

However, this didn't not fix the problem. In fact, I would have to enter credentials, so I assumed that it would be ok to enter my domain credentials (windows 7 credentials).

This created yet another error related to the IIS worker process crashing. I went to the event viewer and I saw this:

Faulting application name: w3wp.exe, version: 7.5.7600.16385, time stamp: 0x4a5bd0eb
Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdfe0
Exception code: 0xe0434f4d
Fault offset: 0x000000000000aa7d
Faulting process id: 0×1634
Faulting application start time: 0x01cbb754642bc4c9
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: a308a667-2347-11e0-ba6c-002318baaa4f

I researched the error and nothing helped me solved the problem. Then, I light of wisdom came into my mind, Application Pools!

So I went to IIS and to the application pools for the SP central admin and the sharepoint site and I changed the identity from NetworkService to LocalService.

I did reset IIS, entered my credentials and wuala!