DataMemberAttribute is another key concept in SysOperation Framework (Data Contracts) in D365 Finance & Operations (D365FO). Let’s go step by step so it’s crystal clear.
DataMemberAttribute is an X++ attribute applied to a property method in a Data Contract.
It marks that property as a serializable parameter for the SysOperation framework.
Essentially, it tells D365FO: “This field is part of the contract and should be included when passing data to the service.”
SysOperation services (batch jobs, AIF services) use Data Contracts to pass parameters.
Without [DataMemberAttribute], the framework will ignore the field, and its value will not be passed to the service.
It also enables the framework to generate the dialog automatically for user input.
[DataContractAttribute]
public class ANSARI_BatchIndividualTaskContract
{
RecId recId;
[DataMemberAttribute("RecId")] // This field is exposed to SysOperation
public RecId parmRecId(RecId _recId = recId)
{
recId = _recId;
return recId;
}
int64 workItemIndex;
[DataMemberAttribute("WorkItemIndex")]
public int64 parmWorkItemIndex(int64 _workItemIndex = workItemIndex)
{
workItemIndex = _workItemIndex;
return workItemIndex;
}
}
Here, both RecId and WorkItemIndex are part of the contract.
When the controller executes the service, these values are serialized and passed to ANSARI_IndividualTaskService::process().
| Feature | Explanation |
|---|---|
| Marks a field as part of the SysOperation contract | Only fields with [DataMemberAttribute] are passed to the service |
| Works with auto-generated dialog | The field appears in the SysOperation form unless hidden via SysOperationControlVisibilityAttribute |
| Required for batch serialization | Without it, the field value will be null in the service |