Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Need some help with some code.

$
0
0

Hello everyone. I have a problem with my code below. I am trying to return the result from the query below and store them in a field called new_names. I have 4 records that have the last name as "Cannon". Using the below, I would like to loop through and produce the following output:  "Cannon, Cannon, Cannon, Cannon".

what i want is just to get the total cannons, and seperate them by a comma and then store them in a field called new_names.

As i am new, can someone help?

string fetch2 = @"<fetch mapping='logical'><entity name='account'> <attribute name='accountid'/> <attribute name='name'/> <link-entity name='systemuser' to='owninguser'> <filter type='and'> <condition attribute='lastname' operator='eq' value='Cannon' /> </filter> </link-entity> </entity> </fetch> "; 

EntityCollection result = _serviceProxy.RetrieveMultiple(new FetchExpression(fetch2));foreach (var c in result.Entities)
   {
   System.Console.WriteLine(c.Attributes["name"]);
   }




Viewing all articles
Browse latest Browse all 8223

Trending Articles



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