tag:blogger.com,1999:blog-1541119677388434036.post1153016424087483799..comments2024-03-28T13:09:49.789+01:00Comments on CRM Answers: GetAttributeValue demystifiedGuidohttp://www.blogger.com/profile/09944164687094653429noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-1541119677388434036.post-13408543646561281442015-07-02T19:17:34.253+02:002015-07-02T19:17:34.253+02:00Well, Well once again down the rabbit hole and I f...Well, Well once again down the rabbit hole and I find you Guido with the answer I was looking for. Next Vendor interview will include a question "When is Null not a value?" We had issue with creating work around and now I can put something more solid in place. <br /><br />I enjoy seeing What Daryl and Ben did as well. The different perspectives combine to make a clear picture for me. Have a great day! Anonymoushttps://www.blogger.com/profile/03044856031205688275noreply@blogger.comtag:blogger.com,1999:blog-1541119677388434036.post-6479746761635386612015-04-29T07:48:04.746+02:002015-04-29T07:48:04.746+02:00GetAttributeValue is really just a wrapper method ...GetAttributeValue is really just a wrapper method that first calls Contains, and if that returns true, uses the indexer to get the value and casts the value to the correct type. Otherwise, it returns default(T). You can just open up the Microsoft.Xrm.Sdk.dll using Telerik JustDecompile and look at the code... :)Larry McCoyhttps://www.blogger.com/profile/09818307547257836765noreply@blogger.comtag:blogger.com,1999:blog-1541119677388434036.post-4957501230053162212015-04-28T14:16:50.200+02:002015-04-28T14:16:50.200+02:00Awesome, also I didn't know you had a blog, do...Awesome, also I didn't know you had a blog, double awesome.The Hoskhttps://www.blogger.com/profile/16247619521154051889noreply@blogger.comtag:blogger.com,1999:blog-1541119677388434036.post-7151944407896230032015-04-27T20:41:29.665+02:002015-04-27T20:41:29.665+02:00I created similar extension methods for working wi...I created similar extension methods for working with AliasedValues as well: http://dotnetdust.blogspot.com/2013/03/simplifying-retrieval-of-aliased-values.htmlDarylhttps://www.blogger.com/profile/11229612024940240358noreply@blogger.comtag:blogger.com,1999:blog-1541119677388434036.post-76915499075497757852015-04-27T18:51:12.609+02:002015-04-27T18:51:12.609+02:00You are right Ben, I also wrote this post to keep ...You are right Ben, I also wrote this post to keep in mind the possible scenarios, sometime I still use Contains because I don't remember right away the default values.Guidohttps://www.blogger.com/profile/09944164687094653429noreply@blogger.comtag:blogger.com,1999:blog-1541119677388434036.post-64395664283867397962015-04-27T10:46:45.032+02:002015-04-27T10:46:45.032+02:00Great post more people should definitely use it, I...Great post more people should definitely use it, I tried to persuade people last year<br /><br />https://crmbusiness.wordpress.com/2014/10/16/crm-2013-using-entity-getattributevalue-instead-of-entity-contains/<br /><br />Developers should be careful when using this code because it will return default values, you must be expecting default values in the code because working out a value using zero could give different results than if your code previously stopped when it was null<br />The Hoskhttps://www.blogger.com/profile/16247619521154051889noreply@blogger.com