Allow a select all option in Dynamic CRM report

2019-07-31 11:07发布

问题:

Let's say I have a very simple SSRS report for Dynamic365 Online as following:

The FetchXML query is as following:

<fetch distinct="false" no-lock="false" mapping="logical">
<entity name="account" enableprefiltering="1" prefilterparametername="CRM_FilteredAccount">
    <attribute name="name" alias="name" />
    <attribute name="createdon" alias="createdon" />
    <attribute name="ownerid" />
</entity>

Now I want to filter account by owner, I add a parameter as following: The value for my filter is retrieved from CRM with the following FetchXML query and will be displayed as a drop down list:

<fetch distinct="false" no-lock="false" mapping="logical">
<entity name="systemuser">
    <attribute name="systemuserid" />
    <attribute name="fullname" />
    <order attribute="fullname" />
</entity>

My intention is user can select an owner, and the report will only display accounts belong to that user, but if they don't select anything then all accounts will be displayed. However, if the drop down list is empty, I get the following error while trying to execute my report:

From what I have found on various websites, "Allow blank value" and "Allow null value" will only work if there already is a blank/null value from the result of my second query. If my filter list were built using SQL query, that would not be a problem since I can simply insert a dummy null value, but I can't find a way to do the same with FetchXML query.

So my question is how can I add a dummy/null value to my filter list in this case?

Note: I have added how I worked around this problem in an answer below, but I feel that must be a better way to solve what I think is a common problem.

回答1:

I added a new dummy user as following, notice that I set the display name for this user as "(Please Select)": Then in my report, I set the default value for my filter as this dummy user, the result is I now have a "select all" option that looks quite well.