Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Suggested answer

Add security duties and privileges into roles using x++ without using security configuration tool

Posted on by 5
Hello fellow D365 F&O professionals!
I am looking for some hints to perform a security configuration by using x++ but without using Security Configuration tool in the UI. Also, I’m NOT looking to create any new security objects in the AOT, so I would aim to strictly do configuring.
 
I would like to find a way to assign existing duties and privileges into a new role in the same way I would do by using a security configuration tool, but via x++.
 
I tried briefly to reverse engineer the code behind the Security Configuration form but found no apparent API for doing this. Maybe I would need to dig deeper, but meanwhile I would appreciate if you share your experiences on this matter. 

Thanks!
 
  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    Add security duties and privileges into roles using x++ without using security configuration tool
    I've never done it and I would challenge the design, but it seems to me that the key parts are SysSecUnpublishedObjects table and SysSecPublishService class.
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    Add security duties and privileges into roles using x++ without using security configuration tool
    Hi Danem,
    According to the problem you described, it seems that you have a problem with adding user security permissions using X++ code, you can refer to this document: Code Example: SecurityUtil Class for Accessing Role and Object Permissions | Microsoft Learn.
    Best regards,
    Kevin

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans