Thursday, December 3, 2009
Correct KernelFunctions xpo
Just a small update on my previous post on Kernel Functions for those interested.
I have now corrected the link to point to the right xpo.
It was previously pointing to a parser class I used to get some of the functions in.
Sorry about that :)
The uploaded xpo is compatible with AX 2009
Wednesday, November 25, 2009
Kernel functions exposed through BC.NET
But one feature that is missing in BC.NET is the ability to call AX kernel functions, like fieldId2Name, num2str, decRound, etc.
I needed to use these functions in my code recently, and in order to access them, I created a class in X++, that simply wraps the useful functions in static methods, kinda like the ones that exist in class Global.
Download Class_KernelFunctions.xpo
You need to import it into AX before using, of course. This can be automated, if you don't want to include this XPO as part of the package you deliver to your customers.
Now you can call it through the Business Connector the following way:
Axapta ax = new Axapta();
ax.Logon("ext", null, "localhost", null);
// num2str(123.45, -1, 2, 1, 1);
Convert.ToDouble(ax.CallStaticClassMethod("KernelFunctions", "num2str", 123.45m, -1, 2, 1, 1));
Tuesday, November 24, 2009
SysCompilerTarget - compiling X++ code without showing the compilation window
So I decided to post a possible solution for this question, re-using one of my previous posts about ClassBuild class.
Basically, AOTcompile method on TreeNode class supports an optional flag, controlling the compilation output:
An integer that indicates whether output should be sent to the message box. If the value 1 is passed, no output is sent to the message box. The default value is 0. This parameter is optional.
So all we need to do now is change the compilation output target to Message Window. Looking at the SysCompilerSetup form code, it's rather easy to come up with the following code:
static void SysCompilerTargetExample(Args _args)
{
ClassBuild classBuild;
DictClass dictClass;
SysCompilerTarget targetOrig;
;
// Setting Compilation Target = Message Window
targetOrig = SysUserInfo::compilerTarget();
SysUserInfo::compilerTarget(SysCompilerTarget::MessageWindow);
SysCompilerOutput::setCompilerTarget(SysCompilerTarget::MessageWindow);
SysCompilerOutput::updateParm();
// Building the class with 1 method
classBuild = new ClassBuild("TRN_ClassBuild", false);
classBuild.addMethod("test", 'void test()\n{\n}');
classBuild.addSourceToMethod("test", @"
;
info('We created a Class and can call its methods');");
// The actual compilation. Note the _flag argument == 1
classBuild.classNode().AOTcompile(1);
// Call the class method to show that we are done and the code is compiled
dictClass = new DictClass(className2Id(classBuild.name()));
dictClass.callObject('test', dictClass.makeObject());
// Restoring Compilation Target to its original value
SysUserInfo::compilerTarget(targetOrig);
SysCompilerOutput::setCompilerTarget(targetOrig);
SysCompilerOutput::updateParm();
}
Don't forget to restore the original settings after the compilation is complete, as shown above.
Friday, November 6, 2009
How to quickly set up Application Integration Framework (AIF) for testing Axd documents
Part of the test effort on our team at MDCC goes for verifying the Axd documents shipped with the Dynamics AX application.
As many people find it hard to setup AIF, I have tried to help them by creating an automated way of doing the initial setup, which can be used for testing the documents using a 1-box setup and FileSystem transport adapter.
Download link
From the following link, you will be able to download an X++ class that initializes all the entities required for AIF to work, like the endpoints, transport adapters and channels, services, their actions and action policies.
Note, that since I am working on the Inventory team, I am filtering out the services accordingly. You can easily extend/modify this to suite your specific needs by changing the filter or adding new ones in classDeclaration and method main
Download xpo
Example from the standard application
To give a specific example, I encourage you to try sending a selected item electronically in form of an XML file right after executing the job.
To do that, navigate to Inventory Management\Common forms\Item details and press Send electronically button. Fill in the values for endpoint, filter on a specific item(s), and press OK.
Your screen should look similar to this:
Processing the document
The document is successfully placed into the queue for processing and sending through the gateway. If you have a batch job for processing AIF services up and running, you will soon see a file in the outbound files folder setup on the outbound channel.
If you would like to learn, how to set up the batch jobs for this, follow the below link: Start and stop the asynchronous AIF services
In order to avoid having to set the batch jobs up, I have added 2 extra methods to the class for starting the processing of inbound and outbound messages.
public static void ProcessOutboundDocuments()
{
new AifOutboundProcessingService().run();
new AifGatewaySendService().run();
}
public static void ProcessInboundDocuments()
{
new AifGatewayReceiveService().run();
new AifInboundProcessingService().run();
}
Just call the DEV_AifInitialSetup::ProcessOutboundDocuments method from a job, and the document will be automatically processed and sent on its way to the outbound documents folder.
Output
The resulting XML file for the item should look similar to the following:
Wednesday, November 4, 2009
Microsoft Layoff 2009 Completes Last Milestone and Ships!
With today's 800 Microsoft layoffs, Microsoft Layoff 2009 has reached its final milestone and shipped, exceeded expectations of 5,000 with 5,800 reduced positions.
Err... yay?
Last week during the Town Hall Mr. Ballmer confirmed there would be one more iteration on the layoffs. And after that? Who knows. More to come? Maybe. Booga booga!
You know, we have people working for Microsoft (or, at least did, I don't know, maybe no longer) responsible for driving executive leadership education and growth at Microsoft. This is their friggin' job. Develop Microsoft Leadership at the executive and L68+ levels. So, has anyone hemmed and hawed in-front of Mr. Ballmer and mentioned that this nickel and diming layoff approach is at the worst case end of the layoff management scale?
The looming threat of continuing RIFs and layoffs indicates that Microsoft is just too big for its leadership. It is beyond their capabilities to wrap their minds around everything Microsoft is doing. It has gotten away from them. What needs to go? Hell, I don't know even what all these people do, and you want to decide who stays and goes?
Yes.
Cut deep. Cut once. Get on with it and say, "We're done. We have aligned our company to be efficient and effective within this new global economic climate and are ready to focus on returning to profits and market share growth."
Done.
Coverage I've noticed today on the outside:
- Mr. Brier Dudley's blog Microsoft cuts 800 more jobs, including 200 in Puget Sound Seattle Times Newspaper
- Mr. Joe Wilcox: Is there any sense to Microsoft's 800 layoffs Betanews and Former Microsofties, Can I Tell Your Story « Oddly Together
- Mr. Nick Eaton Microsoft laying off 800 more
- Ms. Mary Jo Foley Are the Microsoft layoffs over now All about Microsoft ZDNet.com
- Mr. Joseph Tartakoff Microsoft Cuts 800 More Positions paidContent
On Don Dodge:
- Mr. Michael Arrington: Microsoft Loses Don Dodge. This Is A Huge Mistake
- Nick Eaton Startup guru Don Dodge among Microsoft layoffs
- John Cook Startup guru Don Dodge among those let go in Microsoft cuts
And, bummers for me given that she interviewed me for Microspotting, Ms. Ariel Stallings tweet about being caught up in this layoff round.
Coverage from the inside? No email. Quiet. Quite dysfunctional. There was something linked off of the MSW site and it also had a FAQ document that had to be one of the worse FAQs I've ever read. There is an "A" portion to an FAQ and in this case some of the questions were great but the answers looked like they were generated from some sort of English obfuscation Perl script 3rd place prize winner.
So, I'm going through about sixty comments now on the older post. I think it was necessary for Microsoft to have layoffs due to the mismanaged growth and lack of focus and direction our Senior Leadership Team has given us. But it should have been twice as much, done all at once. Now we dither.
Were you affected by the layoff or know someone who was? I'd be interested in knowing which groups and organizations are affected.
Monday, October 26, 2009
Mock objects implementation for AX
But the only real test framework that comes with AX is the SysTest framework (you can read more about it here).
Below you will find another framework for Dynamics AX, that was written by one of the members on my test team and allows to implement and use mock objects for testing the AX application.
More information and download link
It would be great if you could try it out and provide your feedback here or directly on the author's blog.
Thursday, October 22, 2009
Running a class from AOT or "How to assign a class to an action menu item?"
But, in reality, I still now and then meet people who have worked with AX for quite some time, but don't know this very basic concept.
Therefore, I just want to briefly describe it here to refresh everyone's memory
Apart from allowing to run the class from AOT, this will allow to assign it to a menu item (according to Best Practices, it should be a menu item of type Action), and run the class using this menu item.
Below is the correct syntax of the main method:
public static void main(Args _args)
{
//Your code here
}
Please also note, that there is an editor script that contains the template for the main method. You can invoke it from Scripts->template->method->main