All posts by Erik Paulsson

WP-Syntax

When using WordPress to publish code we take advantage of the functionality of a generic Syntax Highlighter created by GeSHi. To use this in WordPress you’ll need a plugin called WP-Syntax.

Example:

1
2
3
4
5
6
7
8
  static void FO_HelloWorld(Args _args)
  {
      str     HelloWorld = "Hello World!";
      ;
 
      print HelloWorld;
      pause;
  }

My advice to anyone that thinks about installing this plugin is to read about it and it’s functionality. The link to the plugin contains good information that descibes how to edit the look of the code display using CSS.

The magic of InventDim “AllBlank”

Using the PriceDisc class in Dynamics AX is not always the easiest thing in the world. If you start out with a sales line or a purchase line you got methods that helps you get prices from the trade agreement, but if all the info you have is the ItemId and VendAccount it gets a bit tricky.

My thinking was that I should be able to use the PriceDisc class just as the InventOnhand class. You put in basic info, and the more data you enter into the class the more precise the result gets. But the hurdle I had trouble getting over was that the class PriceDisc requires a record from table InventDim, something that you only get if you start out with a sales line or a purchase line.
Continue reading The magic of InventDim “AllBlank”

Refresh caller form

We start out in the PurchTable form where we, by clicking a button, calls a class with the help of a menu item. The menu item has been given the datasource PurchTable.

The called class updates the record that was selected in the PurchTable, but when this is done the user cannot see the changes without pressing F5 or restarting the form completely. The method FO_doRefresh() does a refresh on the PurchTable Form.
Continue reading Refresh caller form

Multiple records selected in a form

In Dynamics AX it is possible to select multiple records in any form, well at least you can if more than one record is visible. This example describes a simple way to handle the selected records before doing something with or to them. In this example we have a clicked-method on a button. If, and only if, the new field “newField” on our table “TestTable” is set on all the selected records, then the super() is run.
Continue reading Multiple records selected in a form

Returned item bug

I have only tested this i Dynamics AX SP2, but I would guess that this is also a problem in SP1.

When registering a Sales Order of the type “Returned item”, there are some validations and other functionality that apply. To start with you get an auto generated RMA number. There is also not possible to enter a positive quantity on the order lines, because that would defeat the purpose of the Sales type “Returned item”. The customer is supposed to get money back, not pay the items price again when returning it.

But:
Continue reading Returned item bug

SysInfoAction

Found this blog entry made by Kamal. The entry explains how to use the SysInfoAction classes. I played around with this classes and found out that you can get pretty specific when referring the user to the source of the info message.

This is a simple job that produces an info box that gives the user the option to open a form and edit a specific field on a specific record:
Continue reading SysInfoAction

Copy data between companies

I have recently done some modifications that required certain data that was very time demanding to enter manually in Dynamics Ax. This data was also needed in a number of different companies which meant that I had to enter this data several times.

Because I’m against all that is time consuming I created a script that only require that I enter my data once and then lets me copy this data to the other companies.
Continue reading Copy data between companies

Using CacheAddMethod

When working in forms and using display methods, sometimes they have a tendency to slow down the form to the degree that makes you wonder if it’s worth it at all. This is when cacheAddMethod comes in handy.

When using cacheAddMethod we place the method in memory, the effect of this is that the method only runs once when the form loads and then every time we switch between records. This instead of display methods normal behavior, which means it runs every time all the time.

For the cacheAddMethod to do what it’s supposed to we need it to run when the form starts up. If we have created the display method “OurTestMethod” on table SalesTable we want to place the call to cacheAddMethod in the init method on the form datasource SalesTable.
Continue reading Using CacheAddMethod