I am trying to reassign values to a new template using the code shown below. In some cases, I am finding null values. Usually this is no big deal, just test for null and move on. As you can see, I am trying all the built in tests TryGetValue and ContainsField. The output is null but it is not detected and the Boolean methods return true.
Any ideas around this?
I get the following
ERROR: System.NullReferenceException: Object reference not set to an instance of an object
{
FVC = myEntry.GetFieldValues();
{
if (FVC.PositionToName(j) == "Cancelled Status" && FVC.TryGetValue("Cancelled Status",out outval) && FVC.ContainsField("Cancelled Status"))
{
if (!string.IsNullOrEmpty(FVC[j].ToString()) )
template.cancelledStatus = FVC[j].ToString();
}