I'm trying to get a field from a related CRM Entity in a Dynamics CRM 2013 Workflow. The below code returns the mapped entity but it isn't referencing the matching record in the entity.
How can I update it so it runs the below query against two matched entity Guids? Do I need to use EntityReference?
QueryExpression FindAddressLots = new QueryExpression(context.PrimaryEntityName);
FindAddressLots.LinkEntities.Add
(new LinkEntity(context.PrimaryEntityName, "appdetails_data", "applicationdetailsid", "appdetails_dataid", JoinOperator.Inner));
FindAddressLots.LinkEntities[0].Columns.AddColumns("appdetails_dataid", "suburb", "postcode");
FindAddressLots.LinkEntities[0].EntityAlias = "lotdata";
EntityCollection ec = service.RetrieveMultiple(FindAddressLots);
foreach (Entity act in ec.Entities)
{
if (act.Attributes.Contains("lotdata.suburb"))
{
FindAddressLots = act.GetAttributeValue<AliasedValue>("lotdata.suburb").Value.ToString();
}
}
}
Any suggestions? This would be much appreciated. Thanks.
. If yes does your
address_linked_view` have fieldaddressStreet
As the error mentioned in questions talks aboutaddressStreet
I would request for narrowing down issue do not add any linked entity to your queryexpression and try only with main entity and see if it still throws error. – AnkUseraddress_linked_view
entity does not haveaddressStreet
field/attribute. You might have to go to your system and check whether such field exist. It can also be that schema name of your field is different. Also just for rechecking could you add your newly shredded code as well. – AnkUser