Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I'm using c# to retrieve data from dynamics.
I have a list of accounts and I need to retrieve only those that don't have child accounts.
is there a field name like for example:
that I can use to check if the account has child accounts?
If not, what are my options?
You can try below fetchxml to retrieve the accounts with no child records.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<attribute name="name" />
<attribute name="accountid" />
<condition entityname="childaccount" attribute="accountid" operator="null" />
<link-entity name="account" alias="childaccount" from="parentaccountid" to="accountid" link-type='outer'>
I`m trying to use link entity instead of the xml, but I'm getting exception in the last row.
var accountQuery = new QueryExpression("account");
LinkEntity entity = new LinkEntity()
LinkFromEntityName = "account",
LinkFromAttributeName = "parentaccountid",
LinkToEntityName = "childaccount",
LinkToAttributeName = "accountid",
JoinOperator = JoinOperator.LeftOuter,
Columns = new ColumnSet("name", "statuscode"),
EntityAlias = "childaccount"
FilterExpression Filter1 = new FilterExpression(LogicalOperator.Or);
Filter1.AddCondition("statuscode", ConditionOperator.Equal, _liveStatusCode);
Filter1.AddCondition("statuscode", ConditionOperator.Equal, _implemantation);
FilterExpression Filter2 = new FilterExpression();
Filter2.AddCondition("childaccount", ConditionOperator.Null, null);
FilterExpression mainFilter = new FilterExpression(LogicalOperator.And);
accountQuery.Criteria = mainFilter;
EntityCollection accountResult = organizationService.RetrieveMultiple(accountQuery);
Exception:System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The entity with a name = 'childaccount' with namemapping = 'Logical' was not found in the MetadataCache. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=114852495, MinActiveRowVersion=114852495, MetadataInstanceId=42685471 (Fault Detail is equal to Exception details:
Message: The entity with a name = 'childaccount' with namemapping = 'Logical' was not found in the MetadataCache. MetadataCacheDetails: ProviderType=Dynamic, StandardCache=True, IsLoadedInStagedContext = False, Timestamp=114852495, MinActiveRowVersion=114852495, MetadataInstanceId=42685471
Business Applications communities