Hi guys,Today we see how to add Initialize,Validate methods in contract class in ax 2012 by X++.
In data contract class we have to use SysOperationAlwaysInitializeAttribute.
For Initialize we have to use SysOperationInitializable class.
For Validate we have to use SysOperationValidatable class.
The above 2 methods we have to add in data Contract Class By Implements Key Word.
Check Below code for better UnderStanding.
DataContract Class:
[DataContractAttribute,SysOperationAlwaysInitializeAttribute]
class SysOperationDemoDataContract implements SysOperationInitializable,SysOperationValidatable
{
Name name;
BirthDate birthDate;
}
Initialize method:
public void initialize()
{
name='';
birthDate= dateNull();
}
validate method:
public boolean validate()
{
if (this.parmName('') )
{
return checkFailed('Enter Name Value');
}
return true;
}
Keep Daxing !!
No comments:
Post a Comment