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

How to get value of the incident note field?

$
0
0

Hi,

I am using the "Incident" case in my crm online 2011 environment. I am using the webservice to get data into my c# asp.net web application. I can get all the  fields in the section "Algemeen". But I dont know how to get the note field from the section "Opmerkingen en artikel". Can someone tell me how to access this note field? See below my c# code how I get the other fields.

http://s18.postimg.org/i9ntqukih/Incident_note_field.jpg

            var connection = new CrmConnection("Xrm");
            var context = new CRMServiceContext(connection);
            
            List<Incident> incidents;
            incidents = context.IncidentSet.Where(a => a.AccountId != null).ToList();

            foreach (Incident incident in incidents)
            {
                string fields = string.Empty;
                foreach (KeyValuePair<string, object> attribute in incident.Attributes)
                {
                    if (attribute.Value is Microsoft.Xrm.Sdk.OptionSetValue)
                    {
                        string optionSetValue = incident.FormattedValues[attribute.Key];
                        fields += attribute.Key + ":" + optionSetValue + ", ";
                    }
                    else if(attribute.Value is Microsoft.Xrm.Sdk.EntityReference)
                    {
                        string entityReferenceValue = ((EntityReference)incident.Attributes[attribute.Key]).Name;
                        fields += attribute.Key + ":" + entityReferenceValue + ", ";
                    }
                    else
                    {
                        fields += attribute.Key + ":" + attribute.Value.ToString() + ", ";

                    }
                }
            }

            var query = from a in context.IncidentSet
                        select new
                        {
                            a.Title,
                            a.Id,
                            a.IncidentId,
                            a.LogicalName,
                            a.CreatedBy,
                            a.CreatedOn,
                            a.AccountId,
                            a.Description,
                            a.Attributes,
                            a.incident_customer_accounts,
                            a.incident_customer_contacts,
                            a.StateCode,
                            a.EntityState
                        };

            GridView1.DataSource = query.ToList();
            GridView1.DataBind();


Viewing all articles
Browse latest Browse all 9244

Trending Articles



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