I am working with Dynamics AX 2009 AIF Web Services and I am attempting to use findKeys on the InventItem table and query for records that have a given ModifiedBy user. I am confident that my configuration is correct, as I can query based on any other field, including ModifiedDateTime.
This is part of a solution with the Dynamics Connector and I am attempting to filter out changes caused by MRP regeneration, as these changes do not need to synchronize with Dynamics CRM.
Here is my query:
var criteria = new QueryCriteria();
var element = newList<CriteriaElement>();
element.Add(new CriteriaElement
{
DataSourceName = "InventTable",
FieldName = "ModifiedBy",
Operator = CriteriaOperator.Equal,
Value1 = "user",
Value2 = null,
});
criteria.CriteriaElement = element.ToArray();
var modifiedItemKeys = serviceClient.findKeys(criteria);
This gives the error: ModifiedBy is not a field in data source InventTable.
I am certain that this field is in on the table and that I can query on it via SQL.
I have read that system fields can cause issues however I am able to successfully query based on the ModifiedDataTime like this:
var dateCriteria = new QueryCriteria();
var dateElement = newList<CriteriaElement>();
dateElement.Add(new CriteriaElement
{
DataSourceName = "InventTable",
FieldName = "ModifiedDateTime",
Operator = CriteriaOperator.Greater,
Value1 = (newDateTime(2014, 3, 01)).ToString("s", CultureInfo.InvariantCulture),
Value2 = null,
});
dateCriteria.CriteriaElement = dateElement.ToArray();
var modifiedItemKeys = serviceClient.findKeys(dateCriteria);
The DateTime filter works perfectly fine.
Any assistance would be appreciated, including alternative ideas for filtering out updates cause by MRP.