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

Community site session details

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

Add a role in code.

(0) ShareShare
ReportReport
Posted on by 223
Good day.  I am busy with a development.  According to the selection and the process I want to be able to add a new Role in Code.
I have tried to see how the coding works that is being used with System administration > Security Configuration, but I can not find how I can reuse this from within my code.d
 
Can anyone tell me if this is possible at all.  Once I have the Roles, I will also need to to add a new table, and be able to synchronize for this code.
 
Kind regards
Sophia
I have the same question (0)
  • Martin Dráb Profile Picture
    236,879 Most Valuable Professional on at
    Add a role in code.
    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.
     
    Adding a table at runtime and synchronize the database is impossible; you need to come with a better design for the business requirement. If you need help with the design, please forget implementation details for a moment and tell us what business users need to achieve.
  • André Arnaud de Calavon Profile Picture
    299,924 Super User 2025 Season 2 on at
    Add a role in code.
    Hi Sophia,
     
    There are some data entities that can create new security objects based on details in a source file. When you understand what the data entity is doing, you can mimic the same for creating and publishing a new security role.
     
    Like Martin mentioned, it is not possible to create a new table on runtime. What is the exact business requirement here? 

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 683 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 620

#3
Martin Dráb Profile Picture

Martin Dráb 563 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans