Thursday, 19 May 2016

MS CRM SSRS - Fetchxml Party List Not Supported

I was building a custom SSRS report for an MS CRM Online instance, as usual, I use Advanced Find to build my query, This looks like a straightforward query:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="phonecall">
    <attribute name="subject" />
    <attribute name="createdon" />
    <attribute name="ownerid" />
    <attribute name="actualend" />
    <attribute name="from" />
    <attribute name="regardingobjectid" />
    <order attribute="subject" descending="false" />
  </entity>
</fetch>
When I pasted it into the working area, an error popped up:
The attribute type "PartyList" is not supported. Remove attribute "from" from the query, and try again.
This started to make sense because a Party List field can represent a person or group associated, and SSRS can not simply translate it into a text field. So the solution will be retrieving it from the Activity Party. So I changed the query to include the additional link-entity:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="phonecall">
    <attribute name="subject" />
    <attribute name="createdon" />
    <attribute name="ownerid" />
    <attribute name="actualend" />
    <attribute name="regardingobjectid" />
    <order attribute="subject" descending="false" />
   <link-entity name="activityparty" to="activityid" from="activityid" link-type="outer" >
     <attribute name="participationtypemask" />
     <attribute name="partyid"  />
     <attribute name="partyidname" />
   </link-entity>
  </entity>
</fetch>
More often than not, since the activity party may return multiple results, if you really want to display all results in a single field, you will have to perform additional tweaking to do so. A couple of solutions:
1. Capture and concatenate the activity party field into a custom single text field in CRM, and refer to this field in your report
2. Use custom code to concatenate the value within SSRS. Custom code may not be allowed with the RDL Sandboxing.

But how to do so is beyond the scope of this blog.

1 comment:

  1. To (Recipients):

    =IIF(IsNothing(Join(LookupSet(Fields!activityid.Value, Fields!activityidValue.Value, IIF(Fields!participationtypemaskValue.Value = 2, Fields!partyid.Value, “”), “dsActivityParties”), “,”)),””,Join(LookupSet(Fields!activityid.Value, Fields!activityidValue.Value, IIF(Fields!participationtypemaskValue.Value = 2, Fields!partyid.Value, “”), “dsActivityParties”),”, “).Trim(“, “).Trim())

    From (Sender)

    =IIF(IsNothing(Join(Lookupset(Fields!activityid.Value,Fields!activityidValue.Value,IIF(Fields!participationtypemaskValue.Value =1,Fields!partyid.Value,””),”dsActivityParties”),”,”)),””,Join(Lookupset(Fields!activityid.Value,Fields!activityidValue.Value,IIF(Fields!participationtypemaskValue.Value =1,Fields!partyid.Value,””),”dsActivityParties”)))

    Note:

    Since the records returned by the LookupSet function are in the form of an Array so we use the Join function to show the record collection separated by comma (,).

    ReplyDelete