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

Announcements

News and Announcements icon
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 269
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
    240,275 Most Valuable Professional on at
    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
    306,642 Super User 2026 Season 2 on at
    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 263 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 257 Super User 2026 Season 2

#3
Subra Profile Picture

Subra 235 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans