What is the difference between Entity.Attributes and Entity.FormattedValues?

I’m learning how to write custom workflows and trying to figure out where and in what format all the values ​​I need are stored. I noticed that I can access instance data Entityin Attributesand properties FormattedValues. How to know when to use which?

I noticed the MSDN remark "Entity formatted values ​​are available only for receive operations, not for update operations."

For testing, I made two foreach blocks, iterating through both collections. Attributesgives me 65 lines and FormattedValuesgives me 39. I see that yes, the output from FormattedValues ​​is really formatted. For example, where Attributesgives the output "Microsoft.Xrm.Sdk.OptionSetValue", FormattedValuesgives me a string with the actual value.

What values ​​/ attributes are usually excluded from the collection FormattedValuesand why?

+4
source share
2 answers

, , , ( , , ), , .

, , , , , ( int, DateTime ..), , ( , , ..)

, . , , .

, , , picky "hazaa" 1234. , . , : plainValue , 1234, formattedValue "hazaa".

int plainValue = (int)entity["picky"];
String formattedValue = (String)entity.FormattedValues["picky"];

, , , . , , .

GetAttributeValue <T> (String) , CRM Get <T> (T, String). , IMAO.

+1

All Articles