Pages

Tuesday, August 30, 2011

Validate dialog input in the Business Operation Framework

A number of good community articles have been written on the new Business Operation Framework (BOF) in Microsoft Dynamics AX 2012, for example these series:
And then there is of course MSDN.

However the documentation from Microsoft in this area currently is not yet comprehensive, so here is my first article on a small area of the framework.

If you need to validate the input of the dialog for a data contract, you need to add code to the data contract. Your data contract must implement the SysOperationValidatable interface:
[DataContractAttribute]
public class BOFDataContractA implements SysOperationValidatable
{
    int     parmIntProperty;
    str     parmStrProperty;
}
And you need to add the validate method of the interface:
public boolean validate()
{
    if (this.parmIntProperty() <= 25)
    {
        return checkFailed("The number must be higher than 25");
    }
    return true;
}

Monday, August 22, 2011

Working with files that are supplied by or generated for clients

When you have jobs that require clients to upload a file to AX, or you have a job requiring AX to create a file for client, you earlier had to place the file in a folder with an UNC path available to both the client and the server.

In AX 2012 you can use the class SysFileStoreManager to move the file between server and client, so the client doesn’t need to know about or deal with UNC paths.