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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

SSRS SQL report show data based on login user role

(0) ShareShare
ReportReport
Posted on by 55

I have written SQL query to display created cases and closed cases based on team.But for a agent login it need to only his data.and admin need to see his data as well as agent data.After deploying the rdl it shows same data with different user security roles.any help on this would be appreciated.

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    What did you use to build the report - T-SQL or FetchXml?

  • lathareddy Profile Picture
    55 on at

    SQL queries

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Can you please provide the queries you used?

  • lathareddy Profile Picture
    55 on at

    I have written a query like

    Select case when c.statecode=0 then c.createdon else c.resolvedon,ad.name from incident as a

    Left join systemuser as ac on c.owininguser=ac.systwmuserid

    Left join team membership on ac.systemuserid=teammembership.systemuserid

    Left join team as ad on team membership.teamid=ad teamid

    Where c.createon>=dateadd(day,-7,getdate())

    And ad.name='abc'

    Group by createon,ad.team,resolvedon

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    In order to respect security you should use a Filtered view instead of regular one.

    So the query should be like the following:

    Select

    i.incidentid

    ,i.name

    from FilteredIncident i

  • lathareddy Profile Picture
    55 on at

    Tried that also.but with respect to user login it is not showing data.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    The only other way is to use FetchXml datasource for that purpose.

  • lathareddy Profile Picture
    55 on at

    Can we not use parameter to filter only the current logged in user data

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I'm sorry - I'm not sure what you mean.

  • pskateel Profile Picture
    102 on at

    i have a similar question and i used a fetchxml query to build ssrs report , but not sure what condition i need to add so that logged in user will see  records based on business unit

    community.dynamics.com/.../the-ssrs-report-created-used-in-the-dynamics-365-does-it-show-record-to-users-based-on-security-role-or-it-shows-all-the-record

    a33ik 

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans