Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Get the RelatedEntities/RelatedEntityCollection from an Entity in CRM 2011-SDK.

$
0
0

Hello Guys:

My question:  I have an entity (salesorder) which has many entities related, but when I call the property: RelatedEntities, it doesn´t turn anything:

Please your help, to see if it´s ok, the following code:

protected static void copiarClonEntiRelacionadas(Entity entidadPadre, string nombreEntidadPadre)
        {

            try
            {

               RelatedEntityCollection a = new RelatedEntityCollection();
                a  = entidadPadre.RelatedEntities;

                var d = a.Count;
           
                foreach (KeyValuePair<Relationship, EntityCollection> entidadRelac in a)
                {
                    string b = entidadRelac.Key.ToString();
                    if (b.Equals("order_details"))
                    {
                        foreach (Entity e in entidadRelac.Value.Entities)
                        {
                            string nom = e.LogicalName;
                            object obj = e.GetAttributeValue<string>("productdescription");
                        }
                    }

                }

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + "Clase: EntidadGenerica; Método: copiarClonEntiRelacionadas;\n");
            }

        }

thanks in advanced.


Roxana Cevallos Q. -PARTNER-


Viewing all articles
Browse latest Browse all 1000

Trending Articles



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