Dynamics AX can allow parameters to be optional for a given method. This is accomplished by assigning a parameter to an appropriate value at the top of the method (see below example). If there is no assignment, the parameter is required. The one rule is that all optional parameters must be after the mandatory ones. It is not allowed to have a mandatory following an optional one.
When calling the method, you can see which parameters are mandatory and which are optional as the optional values will show up with a bracket '[' in them in the intellisense.
All that being said, below is how you would accomplish making a table optional with a null value in its place. Simple assign the functions parameter to a value of 'null'.
public void processInbound(Table1 _mandoatoryTableParam, Table2 _optionalTableParam = null)
For additional information about certain data types being null values, see below:
Null Values for Data Types [AX 2012]
http://msdn.microsoft.com/en-us/library/aa846236.aspx
Type
|
Value treated as null
| ||
---|---|---|---|
Date | 1900-01-01 | ||
Enum | Element with its value set to 0. | ||
Integer | 0 | ||
Real | 0.0 | ||
String | An empty string | ||
Time | 00:00:00 | ||
Utcdatetime | Any value with its date portion as 1900-01-01 is treated as null, regardless of the time portion value. Therefore the value 1900-01-01T22:33:44 is treated as null.
|
No comments:
Post a Comment