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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Find Role and Duty by X++ code

(0) ShareShare
ReportReport
Posted on by 229

Hi guys,

Hi  ,

I'm learning some tips on D365 security role.

I'm trying to reach Role and Duty in code but dont find anything on the subject.

Someone know how to do it ?

Thanksfully.

I have the same question (0)
  • Martin Dráb Profile Picture
    238,753 Most Valuable Professional on at

    What exactly do you mean by "to reach"? What are you trying to achieve?

  • Awaxx Profile Picture
    229 on at

    I created some roles, duties and privileges in VS and wanna know how i could find it in code for some manipulation like inserting in custom table or another stuff.

    So i was wondering how i could do that ?

  • Martin Dráb Profile Picture
    238,753 Most Valuable Professional on at

    You normally shouldn't do such a thing - that's the reason why existing code isn't full of such checks and why you can't find information on this subject.

    Please tell us more about your business scenario. Maybe we can suggests a solution that won't depend on a particular role name or something like that.

  • Awaxx Profile Picture
    229 on at

    My complete business scenario is to be able to create and modify privilege permissions  in a chosen role but in x++ code

    So my first goal is to reach the role by code and then it duty and the privilege in there

  • Martin Dráb Profile Picture
    238,753 Most Valuable Professional on at

    What would be a reason for that?

  • Awaxx Profile Picture
    229 on at

    I'm gonna try creating a custom form for security role attribution

  • Suggested answer
    Martin Dráb Profile Picture
    238,753 Most Valuable Professional on at

    Don't reivent the wheel - there already is standard GUI for this purpose. See System administration > Security > Security configuration.

    If you're missing something there, you can extend the standard solution. Don't try to create a parallel solution doing the same thing.

  • alexmeyer.itguy Profile Picture
    670 on at

    Mack,

    You will have to be more specific on what you are trying to do with the roles and duties you are referring to.

    If you are just wanting to query them, there are data entities available (SecurityRoles and SecurityDuties)

    pastedimage1656430079738v2.png

    pastedimage1656430130841v3.png

    Quick Edit:

    It looks like there was some discussion on this post after I started replying, based on your replies I can't answer directly as the company I work for (Fastpath) has a product that does just what you are asking for called Security Designer (https://www.gofastpath.com/grc-for-dynamics-365-fo#tab-7) so it would be under their IP.

    If you really want to go down this path, you can start by looking at the SecurityRepository class.

  • André Arnaud de Calavon Profile Picture
    303,338 Super User 2026 Season 1 on at

    Hi Mack,

    Like mentioned by Martin, first try to use the standard features. You only mentioned you want to change duties and privileges, but you didn't share the business requirement or gaps which might be identified. There are ISV solutions like Fastpath (mentioned by Alex) and Security & Compliance Studio from To-Increase which both offer more functionality compared to the standard.

  • Awaxx Profile Picture
    229 on at

    Hello ,

    First, what i'm trying to do is to simplify form for managing roles, duties and privileges and improve my knowledge on the subject. I need to find a way to update my change on permission in privileges, for example changing the access for 'all customers' screen but by the code on a new customize security form.

    Secondly, I tried to reach SecurityRepository class, but didn't find it on the AOT.

    Where could i find it ?

    Thanksfully.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 509 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 375

#3
Adis Profile Picture

Adis 268 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans