Hi, I have aggregation function inside the link entity, it is returning total number of records, however, when the link entity has no value, there is no result returned, how can I make it return 0 when there is no value. Please advise,
If i understand correctly you want to collect how many records associated with your table , I am not able to see your fetch xml here but i hope you are using outer join for your link entity, Below is working working fetch xml for me
<fetch aggregate="true">
<entity name="account">
<!-- group by the parent you want one row per parent -->
<attribute name="accountid" alias="accountid" groupby="true"/>
<attribute name="name" alias="accountname" groupby="true"/>
<!-- (optional) parent-side filters -->
<filter type="and">
<condition attribute="statecode" operator="eq" value="0"/>
<condition attribute="createdon" operator="on-or-after" value="2026-01-01"/>
<condition attribute="createdon" operator="on-or-before" value="2026-01-15"/>
<!-- Active accounts -->
</filter>
<!-- LEFT OUTER JOIN so parents with no children are included -->
<link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer" alias="c">
<!-- countcolumn is key: returns 0 when no child rows on an outer join -->
<attribute name="contactid" alias="contactcount" aggregate="countcolumn"/>
<!-- Child-side filters (optional): e.g., only active contacts created in the slice -->
<filter type="and">
<condition attribute="statecode" operator="eq" value="0"/>
</filter>
</link-entity>
</entity>
</fetch>
result would be like this
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.