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

How to replicate lookup field on Asp.net

$
0
0

Hi,

I am trying to replicate the forms created on dynamics on a website made with asp.net. Currently i am able to get the list of controls which the form has, but i am having troubles replicating the lookup field because I don`t know what attribute of the associated entity to the lookup is going to be the display value and what entity is going to be the value field.

My code is as follows:

else if (currentAttribute.GetType() == typeof(LookupAttributeMetadata))
{
LookupAttributeMetadata optionMetadata = (LookupAttributeMetadata)currentAttribute;
String EntityName = optionMetadata.Targets[0].ToString();



QueryExpression qe = new QueryExpression();
qe.EntityName = EntityName;
qe.ColumnSet = new ColumnSet(true);
EntityCollection result1 = _orgService.RetrieveMultiple(qe);

foreach (var r in result1.Entities)
{
foreach (KeyValuePair<String, Object> attribute in r.Attributes)
{
Console.WriteLine(attribute.Key + ": " + attribute.Value );
}
}

}


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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