Tuesday, January 08, 2013

Validate dialog input in Business Operation Framework

In AX2012, SysOperation framework replaces the old Runbase Batch framework. While working with it, I wasn’t able to found out how to add validation before closing the dialog. But Palle saves the day. Check out his full posting here.

=====================================
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;
}

No comments:

Post a Comment