{"id":846,"date":"2012-10-18T10:18:17","date_gmt":"2012-10-18T10:18:17","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=846"},"modified":"2012-10-18T10:18:17","modified_gmt":"2012-10-18T10:18:17","slug":"retrieve-ms-crm-datatype-fields-using-late-bound","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=846","title":{"rendered":"Retrieve MS CRM fields using late bound"},"content":{"rendered":"<p>In my earlier <a href=\"http:\/\/mahenderpal.wordpress.com\/2012\/09\/19\/working-with-ms-crm-2011-data-types\/\">post<\/a> I have provided sample code to set different data type fields using late bound in MS CRM 2011. In this post I am going to how can we fetch value from different data type fields.<\/p>\n<p>Entity _Account = service.Retrieve(&#8220;account&#8221;, new Guid(&#8220;XXXXX&#8221;), new ColumnSet(new string[] { &#8220;name&#8221;, &#8220;accountcategorycode&#8221;, &#8220;new_collectiondate&#8221;, &#8220;creditlimit&#8221;, &#8220;parentaccountid&#8221;, &#8220;new_executivecommission&#8221;, &#8220;new_isbilled&#8221; }));<\/p>\n<p>\/\/To fetch string value<br \/>\nstring Name = _Account[&#8220;name&#8221;].ToString();<\/p>\n<p>\/\/To fetch optionset selected value<br \/>\nint OptionSetValue = ((OptionSetValue)_Account[&#8220;accountcategorycode&#8221;]).Value;<\/p>\n<p>\/\/To fetch date time field value<br \/>\nDateTime CollectionDate = ((DateTime)_Account[&#8220;new_collectiondate&#8221;]).Date;<\/p>\n<p>\/\/To fetch money field value<br \/>\ndecimal Creditlimit = ((Money)_Account[&#8220;creditlimit&#8221;]).Value;<\/p>\n<p>\/\/To fetch decimal field value<br \/>\ndecimal Executivecommission = (decimal)_Account[&#8220;new_executivecommission&#8221;];<\/p>\n<p>\/\/To fetch lockup field<br \/>\nGuid ParentAccountID = ((EntityReference)_Account[&#8220;parentaccountid&#8221;]).Id;<\/p>\n<p>\/\/To fetch Boolean field<\/p>\n<p>Boolean IsBilled=(Boolean)_Account[&#8220;new_isbilled&#8221;];<\/p>\n<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/10\/2012-10-18_153309.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-847\" title=\"2012-10-18_153309\" alt=\"\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2012\/10\/2012-10-18_153309.png?w=300\" height=\"120\" width=\"300\" \/><\/a><br \/>\nEnjoy !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my earlier post I have provided sample code to set different data type fields using late bound in MS CRM 2011. In this post I am going to how can we fetch value from different data type fields. Entity _Account = service.Retrieve(&#8220;account&#8221;, new Guid(&#8220;XXXXX&#8221;), new ColumnSet(new string[] { &#8220;name&#8221;, &#8220;accountcategorycode&#8221;, &#8220;new_collectiondate&#8221;, &#8220;creditlimit&#8221;, &#8220;parentaccountid&#8221;, &#8220;new_executivecommission&#8221;, &#8220;new_isbilled&#8221; })); \/\/To fetch string&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=846\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[94,109,165],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/846"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=846"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/846\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}