// Validate Method For contract parameter value at run time in ax 2012
class ClassName implements SysOperationValidatable
{
TransDate fromdate;
TransDate ToDate;
}
public boolean validate()
{
boolean condition = true;
if (!fromdate)
{
condition = checkFailed("From Date should be entered");
}
if (!ToDate)
{
condition = checkFailed("To Date should be entered");
}
if (condition && (fromDate > ToDate))
{
condition = checkFailed(strfmt("From Date should be less than or equal to To Date", date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
}
return condition;
}
class ClassName implements SysOperationValidatable
{
TransDate fromdate;
TransDate ToDate;
}
public boolean validate()
{
boolean condition = true;
if (!fromdate)
{
condition = checkFailed("From Date should be entered");
}
if (!ToDate)
{
condition = checkFailed("To Date should be entered");
}
if (condition && (fromDate > ToDate))
{
condition = checkFailed(strfmt("From Date should be less than or equal to To Date", date2StrUsr(fromDate, DateFlags::FormatAll), date2StrUsr(toDate, DateFlags::FormatAll)));
}
return condition;
}
No comments:
Post a Comment