Parm Method Macro

Friday, 02 October 2015

When making your data contract classes, most of your methods are accessor/setter methods designed to give an interface to the private variables within the class.

Dynamics AX has an understanding that you need to create these methods quite a lot, so it gives you a developer macro for producing the methods.


When you create a new method in your data provider class, if you type "parm" into the editor and then press tab, you will get the dialogue box above, which will create the parm method for you based on the best practises. All you have to do is tell it what the EDT of the parameter is, and its name, and it will make you a method as below:

public FromDate parmFromDate(FromDate _fromDate = fromDate)
    fromDate = _fromDate;
    return fromDate;

Sadly, it doesn’t include the decorations needed to make it work in a data contract (DataMemeberAttribute) but it does save you a lot of laborious typing.

You could modify the xppSource\parmMethod method to change the output that it produces, if you wanted to...

There are a whole bunch of things to investigate, starting with the class EditorScripts - look at the template method methods.