Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How to get/set attribute value irrespective of their DataType in CRM?

$
0
0
Could someone please suggest me how can I retrieve values irrespective of their datatype? Thanks in advance. 
static void UpdateField(IOrganizationService orgService, string entityName, Guid entityId, Entity rollupEntity, Dictionary<string, KeyValuePair<string, string>> attributes)
        {
            Entity _entity = new Entity(entityName);
            _entity.Id = entityId;
            foreach (var attr in attributes)
            {                                
                //_entity[attr.Key] = rollupEntity.GetAttributeValue<AliasedValue>(attr.Key);
                
                if (attr.Key == "id")
                {
                    _entity[attr.Key] = rollupEntity.GetAttributeValue<string>(attr.Key);
                }
                else if (attr.Key == "agreementdate")
                {  
                    _entity[attr.Key] = rollupEntity.GetAttributeValue<DateTime>(attr.Key);
                }              

             }
            orgService.Update(_entity);
         }



Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>