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

Entity Id must be the same as the value set in property bag - After Update

$
0
0

Hey, I am creating a new record and updating it according to another record, but I get the msg, how to solve it ?
My Code: 

 public void Clone(Entity firstNeeds, IOrganizationService Service)
        {
            Entity newneeds  = new Entity(new_needs.EntityLogicalName);
            Guid globalSettingId = Service.Create(newneeds);         
            Entity newRec = Service.Retrieve(new_needs.EntityLogicalName, globalSettingId, new ColumnSet(true));
            foreach (KeyValuePair<String, Object> attribute in firstNeeds.Attributes)
            {
                string attributeName = attribute.Key;
                object attributeValue = attribute.Value;               
                newRec[attributeName] = attributeValue;             
            }

            try
            {  
                Service.Update(newRec);               
            }
            catch (FaultException<OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException("An error occurred in the Clone function.", ex);
            }
        }



Viewing all articles
Browse latest Browse all 79901

Trending Articles



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