I am trying to access a specific field in the first record that is returned to me via the RetrieveMultiple Query Expression code shown below.
However, I am getting the following error when building the code - 'Microsoft.Xrm.Sdk.Entity' does not contain a definition for 'new_licenseinfoId' and no extension method 'new_licenseinfoId' accepting a first argument of type 'Microsoft.Xrm.Sdk.Entity' could be found (are you missing a using directive or an assembly reference?)
The error is related related to the specific line of code immediately below.
var mydata = entities[0].new_licenseinfoId;
As a newbie developer, any help in fixing this so I can assign the specific value I need to the variable mydata would be appreciated.
The complete code that's relevant to this issue so you can see it in context is shown below.
COMPLETE CODE
protected string DoRecsOfSpecifiedYearExist(IOrganizationService service, string year)
{
QueryExpression query = new QueryExpression();
query.EntityName = "new_s_licenseinformation";
query.ColumnSet = new ColumnSet() { AllColumns = true };
query.Criteria = new FilterExpression();
query.Criteria.FilterOperator = LogicalOperator.And;
query.Criteria.Conditions.Add
(
new ConditionExpression("new_licenseyear", ConditionOperator.Equal, year)
);
EntityCollection entities = service.RetrieveMultiple(query);
var mydata = entities[0].new_licenseinfoId;
//Error 2 'Microsoft.Xrm.Sdk.Entity' does not contain a definition for 'new_licenseinfoId' and no extension method 'new_licenseinfoId' accepting a first argument of type 'Microsoft.Xrm.Sdk.Entity' could be found (are you missing a using directive or an assembly reference?)
if (mydata != null)
{
string myYesResponse = "YES";
return myYesResponse;
}
else
{
string myresponse = "NO";
return myresponse;
}
}
*This post is locked for comments
I have the same question (0)