Hi
I'm trying to use a query to retrieve all the invoice records that have a certain value in a custom field and then update the date delivered and the due dates, but I'm getting an error on the retrieve statement:-
Unexpected Error
An error has occurred.
I have traced the error through so I know it occurs on the RetrieveMultipleResponse. The code is as follows:-
DataCollection<Entity> GetInvoiceItems(IOrganizationService service, InArgument<int> ISCNum)
{
QueryExpression qe = new QueryExpression();
qe.EntityName = "invoice";
qe.ColumnSet = new ColumnSet(new string[] { "datedelivered", "duedate" });
ConditionExpression CondOppId = new ConditionExpression();
CondOppId.AttributeName = "new_isc_id_num"; //name found in Invoice Mapping
CondOppId.Operator = ConditionOperator.Equal;
CondOppId.Values.Add(ISCNum); // Can't be the same as the Atribute name.
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.Conditions.AddRange(new ConditionExpression[] { CondOppId });
qe.Criteria = filter;
RetrieveMultipleRequest request = new RetrieveMultipleRequest();
request.Query = qe;
RetrieveMultipleResponse response = (RetrieveMultipleResponse)service.Execute(request);
if (response.EntityCollection != null &&
response.EntityCollection.Entities != null &&
response.EntityCollection.Entities.Count > 0)
return response.EntityCollection.Entities;
else
return null;
}
}
Does anyone have any ideas as to where I'm going wrong. I'm quite new to Dynamics and to C#, so it is probably something very silly. Your help is most appreciated.
Tilly