AxdBase.read Method [AX 2012]
Reads a posted transaction from the database and writes it to an XML string.
Syntax
public AifDocumentXml read(
AifEntityKey _entityKey,
AifSchemaInfo _xsdInfo,
AifEndpointActionPolicyInfo _actionPolicyInfo,
AifConstraintList _constraintList,
AifPropertyBag _aifPropertyBag)
Run On
Server
Parameters
- _entityKey
Type: AifEntityKey Class
An entity key that identifies the transaction to be read.
- _xsdInfo
Type: AifSchemaInfo Class
An instance of the AifSchemaInfo Class, where it is possible to specify the XSD schema to use for filtering.
- _actionPolicyInfo
Type: AifEndpointActionPolicyInfo Class
An instance of the AifEndpointActionPolicyInfo Class, to specify the value mapping to perform. This class can be empty if no value mapping is to occur.
- _constraintList
Type: AifConstraintList Class
A list that contains the constraints that are identified in the document.
The _constraintList parameter must be an instantiated, empty AifConstraintList Class. It will be populated when the read method is run.
- _aifPropertyBag
Type: AifPropertyBag Extended Data Type
An instance of the AifPropertyBag Extended Data Type that contains an XMLDocPurpose Enumeration. It specifies whether the document is an original, a duplicate, a pro forma or a snapshot.
Return Value
Type: AifDocumentXml Extended Data Type
An XML string that contains the data of the transaction.
Remarks
The read method is implemented on the AxdBase Class. If a document does not provide the corresponding action type (SendDocument), the read method must be overridden on the document class for the read method to throw an error if called. For example, AxdSalesPackingSlip.read method.
Examples
The following example shows how to read a purchase requisition in Microsoft Dynamics AX into PurchaseRequisition.xml.
AxdBase axdBase =
AxdBase::newClassId(classnum(AxdPurchaseRequisition));
AifEntityKey aifEntityKey;
Map keyData;
VendPurchOrderJour vendPurchOrderJour;
AifDocumentXml xml;
AifSchemaInfo xsdInfo;
AifEndpointActionPolicyInfo actionPolicyInfo = new
AifEndpointActionPolicyInfo();
AifConstraintList constraintList = new
AifConstraintList();
AifPropertyBag propertyBag;
// Find purchase order record.
select firstonly vendPurchOrderJour;
// Create Key Data.
keyData = SysDictTable::getKeyData(vendPurchOrderJour);
// Create Entity Key.
aifEntityKey = AifEntityKey::construct();
aifEntityKey.parmKeyDataMap(keyData);
propertyBag = [XMLDocPurpose::Proforma];
xml = axdBase.read(aifEntityKey, xsdInfo, actionPolicyInfo,
constraintList, propertyBag);
See Also
AifEndpointActionPolicyInfo Class
AifPropertyBag Extended Data Type