
Greeting everyone
when i try to use my DP class
i've checked my contract also did full compile and there's no error
and here my contract
[DataContractAttribute, SysOperationContractProcessingAttribute(classstr(LeaveReportUIBuilder))]
public class LeaveReportContract implements SysOperationValidatable
{
HcmWorkerRecId hcmWorkerRecId;
List hcmPositionRecId;
List hcmLeaveTypeRecId;
LeaveReportStatuse leaveReportStatuse;
FromDate fromDate;
ToDate toDate;
}
[DataMemberAttribute('FromDate')]
public FromDate parmFromDate(FromDate _dateFrom = fromDate)
{
fromDate = _dateFrom;
return fromDate;
}
[DataMemberAttribute('ToDate')]
public ToDate parmToDate(ToDate _toDate = toDate)
{
toDate = _toDate;
return toDate;
}
[DataMemberAttribute('WorkerRecId')]
public HcmWorkerRecId parmHcmWorkerRecId(HcmWorkerRecId _hcmWorkerRecId = hcmWorkerRecId)
{
hcmWorkerRecId= _hcmWorkerRecId;
return hcmWorkerRecId;
}
[DataMemberAttribute('LeaveReportStatuse')]
public LeaveReportStatuse parmLeaveReportStatuse(LeaveReportStatuse _leaveReportStatuse = leaveReportStatuse )
{
leaveReportStatuse = _leaveReportStatuse;
return leaveReportStatuse;
}
[DataMemberAttribute('PositionRecId')]
public List parmHcmPositionRecId(List _hcmPositionRecId = hcmPositionRecId)
{
hcmPositionRecId= _hcmPositionRecId;
return hcmPositionRecId;
}
[DataMemberAttribute('HcmLeaveTypeRecId')]
public List parmHcmLeaveTypeRecId(List _hcmLeaveTypeRecId = hcmLeaveTypeRecId)
{
hcmLeaveTypeRecId= _hcmLeaveTypeRecId;
return hcmLeaveTypeRecId;
}
public boolean validate()
{
boolean isValid = true;
if (isValid && (fromDate > toDate))
{
isValid = checkFailed(strfmt("Can't be form date bigger than to date"));
}
if (!fromDate && toDate)
{
isValid = checkFailed("you must enter From date or let them both blank");
}
if (fromDate && !toDate)
{
isValid = checkFailed("you must enter To date or let them both blank");
}
return isValid;
}
what should to fix that issue
You didn's specify types of your lists.
Decorate the methods (accepting and retunring lists) with DataCollectionAttribute, if it exists already in AX 2012 (sorry, I don't remember). If not, use AifCollectionTypeAttribute.
For example:
[
DataMemberAttribute('PositionRecId'),
DataCollection(Types::Int64)
]
public List parmHcmPositionRecId(List _hcmPositionRecId = hcmPositionRecId)
{
hcmPositionRecId = _hcmPositionRecId;
return hcmPositionRecId;
}
or
[
DataMemberAttribute('PositionRecId'),
AifCollectionTypeAttribute("_hcmPositionRecId", Types::Int64),
AifCollectionTypeAttribute("return", Types::Int64)
]
public List parmHcmPositionRecId(List _hcmPositionRecId = hcmPositionRecId)
{
hcmPositionRecId = _hcmPositionRecId;
return hcmPositionRecId;
}
By the way, the name is misleading. hcmPositionRecId suggests that the value is a record ID, while it's a collection of record IDs. It's not irrelevant; wrong names can easy lead to errors.