Wednesday, November 30, 2011

Tip - How to write to utf-8 encoding format using CommaTextIo Class

A few months back, I had written a basic post on How to export csv data from AX using CommaTextIO Class

Now, we had a requirement to output the file in utf-8 encoding format and the credit for this post goes to Super Mario (Read below to find who Super Mario is ;-) ..) for his tip which I'm sharing with you all.

Tip/Solution:

The UTF-8 encoding was achieved by using an additional parameter while calling the constructor for CommaTextIO class.The 3rd(optional) parameter is the codepage integer value. It was achieved as per below:
commaTextIo = new CommaTextIo(fileitemdata,#io_write, 65001);

65001 is the Codepage identifier for utf-8

What's interesting in Dynamics AX 2012 for UTF-8:

I was curious to know how UTF-8 is implemented in the new version of Dynamics AX 2012 and did a search at the AOT Level, found that now we have a placeholder for UTF-8 format in AOT > Macros > File
I compared the File Macro in AX 2009 and AX 2012, in AX 2009 there’s no macro for utf-8 but in AX 2012, we have a declaration for it in Macros > File
/*
UTF-8 Format
*/
#define.utf8Format (65001)

But surprisingly it's not used anywhere for e.g. if you see the EditorScripts Class in Dynamics AX 2012, it still uses the literal value 65001 and not the Macro which is defined above.
public void sendTo_file(Editor  e)
{
    Filename filename;
    TextIo io;
    int i = strFind(e.path(), '\\', strLen(e.path()), -strLen(e.path()));
    str defaultName = subStr(e.path(), i+1, strLen(e.path()));
    ;
    filename = WinAPI::getSaveFileName(0, ['Text','*.txt'], '', "@SYS56237", 'txt', defaultName );
    if (filename)
    {
        // BP deviation documented
        io = new TextIo(filename, 'W', 65001); // Write the file in UTF8
        io.write(EditorScripts::getSelectedText(e));
    }
}

I extended our current File Macro by including the following utf encoding declarations under Macros > File for our future reference.

/*
UTF Encoding Format
*/
#define.utf7Format (65000)
#define.utf8Format (65001)
#define.utf16Format (1200)
#define.utf32format (12000)
#define.usascii (20127)

Below MSDN link has the definitions of all the codepage values if you are interested.

Ok Ok... I know you have reached here and still wondering who is Super Mario .. :-) He's my boss who is a techie himself. :-)

Thursday, November 24, 2011

Tip - How to get a blank InventDimId out

Today, while writing a QueryRange, I had to pass a blank InventDimid. Initially, to make life easier ;-). I just put "BLANK".

Then, just did a bit of search and found that InventDim has a static method inventDimIdBlank which was exactly what I required. It returns "AllBlank". Many of you guys might be knowing this one, but just for the ignorant out there (including me) :-) this is a handy tip

InventDim::inventDimIdBlank()

Tip - How to Retrieve AOS Instance name in Dynamics AX via X++ Code

One of my mates asked me how to retreive AOS Instance name through code. My first impression was that it should be somewhere in the Global Class. But, soon figured out I was wrong, then I jumped into Session Class which has a static method getAOSInstance() which retreives the instance number

The requirement here was to extract the instance name. Suddenly, it striked me, that in standard AX in Administration > Online Users form, the last column shows the AOS instance name.

So, the next step was to go through AOT > Forms > SysOnlineUsers > display method getAOSInstanceName() -  here the key is serverSessions.aosId and serverSessions.Instance_Name - combination of both will give you the aos instance.

//BP Deviation documented
display ServerId getAOSInstanceName(SysServerSessions serverSessions)
{
    ServerId            sid = '';
    str                 aosId, machineName, instanceName;
    int                 pos;
    #DEFINE.ATSYMBOL('@')
    ;
    aosId = serverSessions.aosId;
    instanceName = serverSessions.Instance_Name;
    pos = strfind(aosId, #ATSYMBOL, 1, strlen(aosId));
    machineName = substr(aosId, 1, pos-1);
    sid = instanceName + '@' + machineName;
    return sid;
}

Sometimes Googling within AX helps  Njoi  ;-)








Wednesday, November 23, 2011

Dynamics AX Product LifeCycle - Some Key Support Dates

http://support.microsoft.com/lifecycle/search/Default.aspx?sort=PN&alpha=Dynamics%20AX

Above is a good link to be bookmarked, specially if you are interested to know the Support End dates for the Dynamics AX Versions released till date.

Tuesday, November 22, 2011

Tip - Dynamics AX Client and Run as different user in Windows 7 64 bit

I wanted to do some User Permissions testing using Dynamics AX Client with different users using Run As Option. i.e. Right-Clicking the client and then bringing up the Windows challenge dialog wherein one can put the user name and password shown below

















In previous versions of Windows, when you right-click it will bring up the Run as and you can put the user name and password, but with Windows 7, When you Right-Click it just shows "Run as Administrator"

If you need to "Run as different user" then you need to hold the SHIFT button and then Right-Click AX Client.

Learn more about the tip here http://www.winhelponline.com/blog/run-as-different-user-option-inbuilt-windows-7/

Monday, November 21, 2011

Register for Rapid Start Services in Dynamics AX 2012

Regsiter for Rapid Start Services in Dynamics AX 2012

Extracted from Kevin's blog below:

http://blogs.msdn.com/b/dynpartnercommunity/archive/2011/11/07/rapidstart-services-for-microsoft-dynamics-ax-2012-partner-web-seminar.aspx

RapidStart Services is a configuration and setup cloud service from Microsoft that allows a fast and easy way to configure and deploy Microsoft Dynamics AX business processes and scenarios. The core benefits for you as our partner would be:
  • Fast / easy setup of demos and proof of Concepts
  • Repeatable and reusable templates allowing differentiation
  • Better collaboration with customers
  • Structured approach to implementation process
  • Allows Senior Consultants to focus on high-value adds
  • Allows Junior Consultants to go further and learn
This training takes place on Tuesday, November 29 at 11:00AM PT. Register today on the Partner Learning Center.








Download WhitePaper on Credit Card Integration in Dynamics AX 2012


Thought to share with you, the latest whitepaper on Credit Card Processing in Dynamics AX 2012. At a high level, it shows how to setup Credit Card for AX 2012 which integrates with Dynamics ERP - Payment Services provider.

This whitepaper would serve beneficial for those who are planning to implement Credit Card integration with Dynamics AX 2012. Also, Microsoft has a hotfix for Dynamics AX 2009 which is mentioned in the whitepaper.

Some Features:


- Setup Credit Card Processing from a Development perspective
- Automate the process of Authorizing Credit Card amount at the time of order
- Set up Payment Services Providers
- Demo setup
- Dynamics AX 2012 Supports VISA, Master Card, American Express and Discover
- Terms of Payment form modified to cater Credit Card Setup
- New Credit Card Wizard from Customers and Sales Order Form
- Payment Services DLL Reference (from a technical standpoint)
- Credit Card Data Security using TPF (Table Permissions Framework)
- Hotfix for Dynamics AX 2009 to transition to Payment Services Provider Framework


To read in-depth, Please download the whitepaper from this link WhitePaper on Credit Card Processing








Monday, November 14, 2011

How to Configure Kerberos Authentication for SQL and MOSS

Apart from AX, In my current role, I have been extensively working on MOSS/Sharepoint Administration and Troubleshooting, Configuring Kerberos Authentication for SQL, MOSS Server and SSRS, Planning for Disaster Recovery, Troubleshooting SSRS.


This post is on my experience on setting up Kerberos for our standalone MOSS, SQL and SSRS Servers and troubleshooting IIS for Kerberos.


  1. Server Farm Topology
TEST-DEV2 Server: MOSS Server 2007 Farm  (Primary) – Central Administration, IIS


TEST-DEV1 Server:


a.   SQL Server 2008 Database Engine, SSRS 2008 (Sharepoint Integrated Mode)
b. MOSS WFE (Web Front End Part of Server Farm configured on TEST-DEV1)
  1. Setup Kerberos for SQL Server (TEST-DEV1)
Before we setup Kerberos for Sharepoint Server, we need to configure SQL for Kerberos

a. Register SPN’s for SQL Server Service (one  with NETBIOS and other with FQDN) as shown below

Setspn -a http/<computer-name>.<domain-name>:<port> <domain-user-account>

  1. Test  the connectivity on SQL Server is via Kerberos and not NTLM
Logon to SSMS (staying in the same box) and fire the below SQL, if SPN’s are properly setup, then you should see KERBEROS in auth_scheme field.








  1. Another way to test if Kerberos is being used as Authentication scheme is to bring up Central Administration site and now go back to TEST-DEV1 (the host box where SQL is running). Bring up the Event Viewer (check Security tab)

  1. In the Security Log, you should be able to see Success audit record for Logon/Logoff category event


Check the Detailed Authentication information and should be able to see the Login mechanism as Kerberos which confirms our test that MOSS is communicating with SQL via Kerberos


  1. Setup Kerberos for MOSS Server (TEST-DEV2)
Register SPN’s for MOSS Server (Service account) in the similar fashion as we did for SQL:
  1. Register with NETBIOS name
  2. Register with FQDN name as shown below






  1. Browse to Central Administration website and confirm by going to the Event Viewer of the hostmachine in Security log, (similar to the steps we performed for SQL) that the authentication package here is Kerberos

TROUBLESHOOTING:

A.
Troubleshooting IIS Authentication HTTP Error 401 after Kerberos is setup for MOSS Server Farm

Note: If you are running IIS 7.0 server in a Web farm the KDC will not know in advance which individual server the request may go to and hence ticket decryption may fail
Bring up IIS Manager, Go to each of your websites and turn off the Kernel Mode Authentication under Windows Authentication Advanced Settings option




OR


Let Kernel mode authentication be enabled and the Application pool's identity be used for Kerberos ticket decryption. The only thing you need to do here is:
1. Run the Application pool under a common custom domain account.
2. Add this attribute "useAppPoolCredentials" in the ApplicationHost.config file.
<system.webServer>
  <security>
     <authentication>
        <windowsAuthentication enabled="true" useKernelMode="true" useAppPoolCredentials="true" />
     </authentication>
  </security>
</system.webServer>
Remember there is no GUI setting for this. You need to modify the ApplicationHost.config file from
<%SystemDrive%>/Windows/System32/inetsrv/config folder on the IIS 7.0 machine.


Note:
Tried both the options but Option A works fine with Option B, there’s this frequent system crash as I reckon it’s changing the applicationhost.config file settings. Need to check this behaviour in Production Server as Option B is more performance friendly and recommended approach


B.
Configuring Kerberos for SSRS (running in Sharepoint Integrated Mode):
  1. Register SPN for SSRS Server Instance  (both with NETBIOS and FQDN)

Setspn -a http/<computer-name>.<domain-name>:<port> <domain-user-account>
  1. Open the RsReportServer.config file and locate the <AuthenticationTypes> section. Add <RSWindowsNegotiate/> as the first entry in this section to enable Kerberos

  1. Test: Deploy a Report through BIDS to  a Report Center site, http://test-dev2/rc/


Troubleshooting tip: You may run into error rsaccessdenied: The account SHarepoint/System doesn’t have permissions to deploy the report. In order to troubleshoot this error, check if spn’s are properly registered with the sharepoint service account and there’s no duplicity of SPN’s.

Friday, November 11, 2011

Update - Inside Dynamics AX 2012 Videos (Videos #10,11 and 12)

The video series on "Inside Dynamics AX 2012" is complete now, with Videos on Simplicity, Workflow and Organization Model added.


http://daxdilip.blogspot.com/2011/08/inside-microsoft-dynamics-ax-2012.html


Would recommend you to bookmark it. Njoi :)

Thursday, November 3, 2011

Dynamics AX Error executing code: Overflow in internal run stack

Error:

Got this run-time error during a full run of inventory settlement data - "Error executing Code: Overflow in internal run stack.



Troubleshooting Steps:

After some investigation, found out that this was being caused due to circular reference in one of the settlement transaction due to which the container fills up thereby resulting in run-time stack overflow.