I have a fetch string that retrieve a field from main entity a field from linked entity.
Both fields are entity reference, I was able to retrieve the entity reference from main entity using below:
EntityReference field1 = result.Entities[0].GetAttributeValue<EntityReference>("field name");
However, I was not able to retrieve the entity reference from linked entity, I tried the following and none worked.
EntityReference field2 = result.Entities[0].GetAttributeValue<EntityReference>("field name");
EntityReference field2 = result.Entities[0].GetAttributeValue<EntityReference>("linked alias.field name");
EntityReference field2 = (EntityReference)result.Entities[0].GetAttributeValue<EntityReference>("linked alias.field name");
I also see people adding .Value on some google tutorials but .Value is not a valid method for entity reference, please let me know what is the correct syntax to use.