I'm attempting to update a Boolean field through a Dataverse Plugin. I'm currently getting an error.
Error Message: Exception Message: Date is less than the minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00
I know what you're thinking... Your datetime field is null, you need to check for null first and not use it if it's null.. Yep, that's what all the forums say as well as all of the help info I can find. The problem is that I'm not updating a DateTime field. I'm pulling an Entity with a custom ColumnSet of a single field, which is a Boolean. I'm updating the Boolean then updating the Entity. No dates involved. Maybe 1 out of every 5 runs of the code below results in this error. I did check to see if there are any required fields in the table that are DateTime fields. There are two, and they're always filled in. Anyone have an idea as to what is going on here?
if (FoundStudent && !Rejected) { EntityCollection EnrollAYList = service.RetrieveMultiple(new FetchExpression(string.Format(fetchEnrollAY, Student.Id, AwardYear.Id, AwardYear.Id))); if (EnrollAYList.Entities.Count > 0) { foreach (var AY in EnrollAYList.Entities) { Guid AY_ID = ((Guid)AY.GetAttributeValue("pt_enrollmentacademicyear1.pt_enrollmentacademicyearid").Value); Entity EnrollAY = service.Retrieve("pt_enrollmentacademicyear", AY_ID, new ColumnSet("pt_autocreateawards")); if (EnrollAY.Contains("pt_autocreateawards")) { EnrollAY["pt_autocreateawards"] = true; } else { EnrollAY.Attributes.Add("pt_autocreateawards", true); } service.Update(EnrollAY); } } }