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 :
Dynamics 365 Community / Forums / Finance forum / Security Sub Roles not...
Finance forum

Security Sub Roles not working

(0) ShareShare
ReportReport
Posted on by 411

I have an issue on one of my environments with coded security sub roles. The sub roles appear on the security  configuration screen but not on the user role assignation screen. We tried to run a db sync on the environment, although successful, it did not resolve our issue. 

Capture_5F00_1.PNG

Capture_5F00_2.PNG

  • Suggested answer
    PilgrimCZ Profile Picture
    572 on at

    Hi Ashwin,

    roles need to be coded as standard roles to have them on user role assigment. A presume that you have coded reference to roles, that do not exist.

    Marek

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Do you have any security role configuration that was made via the user interface? If yes, that will have higher priority than the AOT changes.

  • Community Member Profile Picture
    on at

    Have you tried publishing the security objects in your environment?

    If that does not help I would also assume that you have perhaps referenced a security role which does not exist.

  • André Arnaud de Calavon Profile Picture
    307,289 Super User 2026 Season 2 on at

    Hi Ashwin,

    If the security role has sub-roles, you can only see the security role on the user assignment. The contents of the role with duties, privileges and also sub roles are not visible, but working. It is not like that the sub roles will also be assigned automatically as separate roles.

  • Community Member Profile Picture
    on at

    Hi André.

    If you look at Ashwins screenshot you will see that the security role assigned to the user does not contain any subroles, if you have a look at the system user role in his screenshot it is indicated that this security has subroles.

    This indicates that the custom security role does not contain the subroles assigned, my best guess would still be that he needs to publish the changes and some modifications have been done to the roles. Maybe the subroles have been done as customization while the link in the parent role is coded, and they have forgotten to publish the subroles. It seems like a strange approach, but could be the reason.

  • André Arnaud de Calavon Profile Picture
    307,289 Super User 2026 Season 2 on at

    @NikolajS: Thanks for pointing me to the screenshot. It was very small on my mobile device. Now it is clear on my laptop.

    @Ashwin: The tab Unpublished objects contains 30 elements. Like NikolajS mentioned, try publishing these objects first. Note that the security configuration is a work document form. If you have unpublished objects, it will not show the security objects as currently active.

  • Ashwin Jugurnauth Profile Picture
    411 on at

    Hello Everyone,

    Thank you for your insight.

    The issue on this environment (training) appeared when we restored the production database on it. The code is aligned on both environments (same build version). However, our functional guys have created a lot of roles in front-end in production. I was able to publish all roles except one. When I try to publish this role, I get the following message : 

    Capture_5F00_3.PNG

    Same thing happens when I try to synchronize security objects from the application. Not sure what to do next. I have checked the AOS events and I came accross the following message : 

    - EventData
    exceptionMessage Cannot insert duplicate key row in object 'dbo.SECURITYROLEEXPLODEDGRAPH' with unique index 'I_65485ROLESUBROLEIDX'. The duplicate key value is (680, 680). The statement has been terminated.
    exceptionSource .Net SqlClient Data Provider
    exceptionStackTrace at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.RunParser(BulkCopySimpleResultSet bulkCopyHandler) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinuedOnSuccess(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source) at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken) at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState) at Microsoft.Dynamics.AX.Security.Management.RoleExplodedGraphSync.BulkInsert(Func`1 getDatabaseContext, Boolean canLockTable, IEnumerable`1 roleFlattenedInfoEnumerable, Boolean isFullSync, Dictionary`2 roleRecidMap, Int64 maxRecid) at Microsoft.Dynamics.AX.Security.Management.RoleExplodedGraphSync.Run(Func`1 getDatabaseContext, Boolean canLockTable, IEnumerable`1 roleFlattenedInfoEnumerable, Dictionary`2 roleRecidMap, Int64 maxRecid) at Microsoft.Dynamics.AX.Security.Management.TablePublisher.PublishOptimizationTables(SecurityRepository securityRepository, Func`1 databaseContextFunc, Boolean canLockTable, Dictionary`2 roleRecidMap, Dictionary`2 dutyRecidMap, Dictionary`2 privilegeRecidMap, PermissionGraph permissionGraph) at Microsoft.Dynamics.AX.Security.Management.TablePublisher.Run(Func`1 databaseContextFunc, Boolean canLockTable, ObjectEventRecorder eventRecorder, SecurityRepository securityRepository, SecurityIdentifiersSetsStatesBag identifierSetStates, Boolean autoIncludeMissingDependencies, SecurityIdentifiersBag& missingDependencies, HashSet`1 rolesToRecalculate) at Microsoft.Dynamics.AX.Security.Management.PublishManager.PublishChanges(SecurityIdentifiersSetsStatesBag setStatesBag, Boolean autoIncludeMissingDependencies, SecurityIdentifiersBag& missingDependencies) at Microsoft.Dynamics.AX.Security.Management.UI.PublishService.PublishForceAll() at Dynamics.AX.Application.SysSecPublishService.`PublishForceAll() in xppSource://Source/ApplicationFoundation\AxClass_SysSecPublishService.xpp:line 153
  • Verified answer
    Mahmoud Hakim Profile Picture
    17,887 on at

    Try to publish objects ,

    as I see in your screenshot , there are 30 objects need to publish

  • Verified answer
    PilgrimCZ Profile Picture
    572 on at

    Hello Ashwin,

    One question. Was there some role or subrole created by hand in training environment? It seems that you have codec role/subrole and manually created role/subrole that have same value. So when you run sync, application tries to add row from app to DB, and failed. This table do not allow duplicates. You may try delete (not publish) this role and run sunc without it. Then recreate it manually, if will not be synced from DB. Recreation gives it new value.

    Marek

  • Ashwin Jugurnauth Profile Picture
    411 on at

    Hello,

    We did a full restore from production to training, so the data on training environment should be aligned with production.

    Ashwin

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans