I would like to get rid of the Social Pane on Dynamics 365, by replacing it with a Subgrid on the account form which would list the activities of the account and the activities of the account's contacts. We are currently using the "parentcustomerid" lookup to associate a contact to an account which is not hierarchical. I cannot find a solution with FetchXML to get what I want. The following FetchXML would work if there was a hierarchical relation:
<fetch>
<entity name="activitypointer" >
<attribute name="activityid" />
<attribute name="regardingobjectid" />
<attribute name="subject" />
<attribute name="regardingobjecttypecode" />
<filter type="and" >
<condition attribute="isregularactivity" operator="eq" value="1" />
<filter type="or" >
<condition entityname="accountparty" attribute="accountid" operator="eq-or-under" value="5D8E9289-7F86-E811-910D-0050568B95ED" />
<condition entityname="contactparty" attribute="contactid" operator="eq-or-under" value="5D8E9289-7F86-E811-910D-0050568B95ED" />
</filter>
</filter>
<link-entity name="activityparty" from="activityid" to="activityid" link-type="outer" alias="activityparty" >
<link-entity name="account" from="accountid" to="partyid" link-type="outer" alias="accountparty" />
<link-entity name="contact" from="contactid" to="partyid" link-type="outer" alias="contactparty" >
<link-entity name="account" from="accountid" to="parentcustomerid" link-type="outer" alias="contactaccount" />
</link-entity>
</link-entity>
The goal is to have a plugin that catches the query in pre-operation in order to add the conditions and filters needed.