Using VAF, I want to assess the values of two Date Properties in a state trigger.
First I check to see if the Property is on the Object using the TryGetProperty method, since if there is no required date property on the object we know this is going to fail. But then I wasn't sure if TryGetProperty would succeed if the property is on the object but has no value (IsNull should then be true). I don't think it is possible for IsUninitialized to be true as that would only be the case if the SetValue had never been invoked, but I am assuming that the GetProperty, when it succeeds constructs the TypedValue even if it is Null.
I'm trying to make sure I don't blow up when I try to cast the Value to a DateTime to see if I've passed the required date.
if (!env.PropertyValues.TryGetProperty(PDAssessmentDateID, out PropertyValue assessmentDate)) { return false; } //I think the previous checks would catch these but not sure if(assessmentDate.TypedValue.IsNULL() || assessmentDate.TypedValue.IsUninitialized()) { return false; } bool timeToAssess = (DateTime.Now.Subtract((DateTime)assessmentDate.Value.Value).TotalDays > 0); return timeToAssess;