User-241612745 posted
Below is the information I have so far and where I am running into my problem. After I have authenicated with CRM, I retrieve all records from an entity called product from CRM. Below is the cutdown code I use to do this:
'Grab information from Entity in CRM
Dim Prods As New QueryExpression("product")
Dim Cols() As String = {"productid", "productnumber", "tci_strength", "name", "tci_maxcoarse", "tci_mtype", "tci_prodcat", "new_location", "new_slumprange", "new_bu", "tci_isspec", "tci_opportunity", "tci_plantno", "pricelevelid", "price", "quantitydecimal", "standardcost", "currentcost", "defaultuomscheduleid", "defaultuomid", "description"}
Prods.ColumnSet = New ColumnSet(Cols)
Dim ProductsList = service.RetrieveMultiple(Prods)
After I have "grabbed" all information, for a normal field I use the following to grab the value from a specific field in the record:
Dim productid As String = ProductsList(intcnt).Attributes("productid").ToString
This works great until I get to a lookup field (EntityReference), for example tci_mtype is a lookup field so if I do the following:
mtype = ProductsList(intcnt).Attributes("tci_mtype").ToString
mtype return value is Microsoft.Xrm.Sdk.EntityReference
BTW, mtype is declared as follows: Dim mtype As String
I hope this explains my issue and Hope someone can help :)