AxdBase.findList Method [AX 2012]
Finds posted transactions from the database, and then writes them to an XML string.
Syntax
public AifDocumentXml findList(
AifQueryCriteria _queryCriteria,
AifSchemaInfo _xsdInfo,
AifEndpointActionPolicyInfo _actionPolicyInfo,
AifConstraintListCollection _constraintListCollection,
AifPropertyBag _aifPropertyBag)
Run On
Server
Parameters
- _queryCriteria
Type: AifQueryCriteria Class
An instance of the AifQueryCriteria Class that contains either a query or an array of criteria to identify the documents by.
- _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. Use this class to specify the value mapping to perform. This class can be empty if no value mapping is to occur.
- _constraintListCollection
Type: AifConstraintListCollection Class
A collection of lists that contains the constraints that are identified for each document.
The _constraintListCollection parameter must be an instantiated, empty AifConstraintListCollection Class. It will be populated when the findList 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 transactions.
Remarks
The findList method is implemented on the AxdBase Class. If a document does not provide the corresponding action type (QueryDocuments), the findList method must be overridden on the document class for the findList method, if called, to throw an error. For example, the AxdSalesPackingSlip.findList method.
Examples
The following example shows how to find purchase requisitions in Microsoft Dynamics AX by using a query and have them returned as an XML string.
// Example on findList by using a query.
AxdBase axdBase = AxdBase::newClassId(
classnum(AxdPurchaseRequisition));
AifQueryCriteria queryCriteria = AifQueryCriteria::construct();
Query query;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
AifDocumentXml xml;
AifSchemaInfo xsdInfo;
AifPropertyBag propertyBag;
AifEndpointActionPolicyInfo actionPolicyInfo = new
AifEndpointActionPolicyInfo();
AifConstraintListCollection constraintListCollection = new
AifConstraintListCollection();
query = new Query();
queryBuildDataSource = query.addDataSource(
tableNum(vendPurchOrderJour),
'vendPurchOrderJour');
queryBuildRange = queryBuildDataSource.addRange(
fieldNum(vendPurchOrderJour, purchId));
queryBuildRange.value('..00014_049');
queryCriteria.parmQuery(query);
propertyBag = [XMLDocPurpose::Proforma];
xml = axdBase.findList(
queryCriteria,
xsdInfo,
actionPolicyInfo,
constraintListCollection,
propertyBag);
The following example shows how to find purchase requisitions in Microsoft Dynamics AX by using an array of criteria and have them returned as an XML string.
// Example on findList using an array of criteria.
AxdBase axdBase = AxdBase::newClassId(
classnum(AxdPurchaseRequisition));
AifQueryCriteria queryCriteria = AifQueryCriteria::construct();
AifCriteriaElement criteriaElement;
AifDocumentXml xml;
AifSchemaInfo xsdInfo;
AifPropertyBag propertyBag;
AifEndpointActionPolicyInfo actionPolicyInfo = new
AifEndpointActionPolicyInfo();
AifConstraintListCollection constraintListCollection = new
AifConstraintListCollection();
criteriaElement = AifCriteriaElement::newCriteriaElement(
'vendPurchOrderJour',
'purchId',
AifCriteriaOperator::LessOrEqual, '00014_049');
queryCriteria.addCriteriaElement(criteriaElement);
propertyBag = [XMLDocPurpose::Proforma];
xml = axdBase.findList(
queryCriteria,
xsdInfo,
actionPolicyInfo,
constraintListCollection,
propertyBag);
See Also
AifEndpointActionPolicyInfo Class
AifConstraintListCollection Class
AifPropertyBag Extended Data Type