In this post I will show how to retrieve all the activities in which a record is related to as:
- BBC Recipient
- CC Recipient
- Customer Optional Attendee
- Organizer
- Owner
- Regarding
- Required attendee
- Resource
- Sender
- To Recipient
It is also possible, of course, to select only few of them. To achieve this I will use a fetch XML query.
Here is the query:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="
activitypointer">
<attribute name="activitytypecode" />
<attribute name="subject" />
<attribute name="statecode" />
<attribute name="prioritycode" />
<attribute name="modifiedon" />
<attribute name="activityid" />
<attribute name="instancetypecode" />
<order attribute="modifiedon" descending="false" />
<link-entity name="
activityparty"
from="
activityid"
to="
activityid"
alias="
aa">
<filter type="and">
<condition attribute="
participationtypemask"
operator="in">
<value>4
</value>
<value>3
</value>
<value>11
</value>
<value>6
</value>
<value>7
</value>
<value>9
</value>
<value>8
</value>
<value>5
</value>
<value>10
</value>
<value>1
</value>
<value>2
</value>
</condition>
<condition attribute="
partyid"
operator="
eq"
uitype="
contact"
value="
Xrm.Page.data.entity.getId()" />
</filter>
</link-entity>
</entity>
</fetch>
The corresponding advanced find query is:
Hope this helps,
Luciano.