We have Dynamics CRM 2011 on premises. In a C# console app I have the following code:
xrm.MergeOption = MergeOption.OverwriteChanges;
xrm.ClearChanges();
var InvoiceDetails = from id in xrm.InvoiceDetailSet
where id.Id == gInvoiceDetailId
select id;
foreach (var invoicedetail in InvoiceDetails)
{
try
{
invoicedetail.ce_DelinquencyReported = true;
xrm.UpdateObject(invoicedetail);
xrm.SaveChanges();
}
catch (Exception ex)
{
String sMessage = "Error is " + ex.Message;
oHelper.TimeStamp(sMessage, string.Empty, log, EventLogEntryType.Error);
}
}
This failed the last time I ran the program and the error was "
An error occured while processing this request". How can I determine what went wrong?