The find method on an AIF service is used to retrieve a single record using one or more fields to base your query on. It is slightly different from the Read action because the Read action returns a record but it requires the primary key be used in the query criteria for the record. Here is a method that sets up the criteria for a find of a sales order using the SalesId field:
private static QueryCriteria createQueryCriteria(string salesIdValue)
{
CriteriaElement[] criteriaElements = new CriteriaElement[1];
criteriaElements[0] = new CriteriaElement();
criteriaElements[0].DataSourceName = “SalesTable”;
criteriaElements[0].FieldName = “SalesId”;
criteriaElements[0].Value1 = salesIdValue;
QueryCriteria queryCriteria = new QueryCriteria();
queryCriteria.CriteriaElement = criteriaElements;
return queryCriteria;
}
Then use the queryCriteria object in your call to the find method:
foundSalesOrder = proxy.find(this
.createQueryCriteria(salesIdValue));