Looking to add our subject entity parentsubjects to a dictionary. I have been able to create the array as follows, with the ‘title’ required appearing in Attributes > Values within each subject selected:
var query = new QueryExpression()
{
EntityName = Subject.EntityLogicalName,
ColumnSet = new ColumnSet("title"),
Criteria = new FilterExpression()
};
query.Criteria.AddCondition("parentsubject", ConditionOperator.Null);
query.ColumnSet.AddColumns("title");
var subjectRecords = myCRMProxy.RetrieveMultiple(query).Entities.ToArray();
Entity[] allSubjects = subjectRecords;
Previously we have added our optionsets to a dictionary using the code below – the OptionMetadata class has the Value / Label methods needed but I’ve been unable to find a similar class that invokes these against the entity;
foreach (OptionMetadata optionMetadata in optionList)
{
dictionary.Add((Int64)optionMetadata.Value, optionMetadata.Label.LocalizedLabels[0].Label);
}
How can we add the entity array Values to our dictionary? Any help immensely appreciated.