I was looking at the CRM 2011 entity today. I was having to search the entity attributes to find a the value of a variable/field.
Initially when I did this the entity variable is ent
ent.GetAttributeValue(fieldname);
I was getting nothing
I then did a count on the number of attributes in the entity
ent.Attributes.Count
it returned 51 but the entity had 83 attributes. Which meant I was missing 32 variables.
I found out that it only lists the attributes that don’t have a null value. I worked this out because I went and gave one of the missing fields a value and then it appeared in the list of attributes.
This makes sense really because why bother including lots of variables which haven’t been set and don’t have a value but it can be quite confusing if you aren’t expecting it and have put some logic in based on the variable