web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Dynamics SSRS Report not selecting current Account in PreFiltered Report

(0) ShareShare
ReportReport
Posted on by
Hello Community

I have a report which I have built to use the current selected account. The issue is that the report still selects all records instead of the current selected one. I have created a Parameter named "CRM_FilteredAccount" and set the default value to:

Select * from FilteredAccount

Then I create the query like this:

declare @sql as nVarchar(max)
set @sql = '
SELECT 
    CRMAF_org.bsv_targetgroupattribute1, 
    pos.bsv_address_multiline, 
    pos.bsv_memberlist_memberlistcode, 
    pos.owneridname, 
    mbl_bsv_memberlist.bsv_memberlistcode, 
    pos.bsv_count_german, 
    pos.bsv_count_french,
    pos.bsv_count_italian,
    pos.bsv_count_rr,
    pos.bsv_count_english
FROM Filteredbsv_memberlist as mbl_bsv_memberlist LEFT JOIN 
Filteredbsv_memberrelation as pos ON pos.bsv_memberlist = mbl_bsv_memberlist.bsv_memberlistid LEFT JOIN 
('   @CRM_FilteredAccount   ') as CRMAF_org ON CRMAF_org.accountid = pos.bsv_organization'

exec(@sql)


To enable the PreFiltering I've set the CRMAV_ Prefix for the FilteredAccount alias and added the parameter to the query like shown above.

So the XML of the Parameter looks like this:

    
      String
      true
      
        
          Select * from FilteredAccount
        
      
      true
      CRM_FilteredAccount
      true
    
  

And the dataset:

      
        BSV
        
          
            =Parameters!CRM_FilteredAccount.Value
          
        
        declare @sql as nVarchar(max)
set @sql = '
SELECT 
    CRMAF_org.bsv_targetgroupattribute1, 
    pos.bsv_address_multiline, 
    pos.bsv_memberlist_memberlistcode, 
    pos.owneridname, 
    mbl_bsv_memberlist.bsv_memberlistcode, 
    pos.bsv_count_german, 
    pos.bsv_count_french,
    pos.bsv_count_italian,
    pos.bsv_count_rr,
    pos.bsv_count_english
FROM Filteredbsv_memberlist as mbl_bsv_memberlist LEFT JOIN 
Filteredbsv_memberrelation as pos ON pos.bsv_memberlist = mbl_bsv_memberlist.bsv_memberlistid LEFT JOIN 
('   @CRM_FilteredAccount   ') as CRMAF_org ON CRMAF_org.accountid = pos.bsv_organization'

exec(@sql)

What I dont know is if the CRMAF_ prefix will only be evaluated by dynamics if it is placed right after the FROM in the query. Maybe this construct does not work if the prefilter prefix is part of a join?

I have the same question (0)

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans